History

remove build error if MEMORY_CHECK is on

Sijia Chen committed 11 years ago

Commit 4fb4c951 parent 52cd5d91 file · +9 −8Browse files

Showing the changes to codec/common/src/memory_align.cpp (1 of 1 file). Show all

Unified · Split

codec/common/src/memory_align.cpp+9−8
@@ -40,6 +40,7 @@ namespace WelsCommon { · 39 unmodified lines
40#ifdef MEMORY_CHECK40#ifdef MEMORY_CHECK
41static FILE* fpMemChkPoint;41static FILE* fpMemChkPoint;
42static uint32_t nCountRequestNum;42static uint32_t nCountRequestNum;
43static int32_t iMemoryLength;
43#endif44#endif
44 45
45 46
@@ -71,8 +72,8 @@ void* WelsMalloc (const uint32_t kuiSize, const char* kpTag, const uint32_t kiAl · 25 unmodified lines
71 uint8_t* pBuf = (uint8_t*) malloc (kiActualRequestedSize);72 uint8_t* pBuf = (uint8_t*) malloc (kiActualRequestedSize);
72#ifdef MEMORY_CHECK73#ifdef MEMORY_CHECK
73 if (fpMemChkPoint == NULL) {74 if (fpMemChkPoint == NULL) {
74 m_fpMemChkPoint = fopen ("./enc_mem_check_point.txt", "at+");75 fpMemChkPoint = fopen ("./enc_mem_check_point.txt", "at+");
75 m_nCountRequestNum = 0;76 nCountRequestNum = 0;
76 }77 }
77 78
78 if (fpMemChkPoint != NULL) {79 if (fpMemChkPoint != NULL) {
@@ -101,10 +102,10 @@ void* WelsMalloc (const uint32_t kuiSize, const char* kpTag, const uint32_t kiAl · 22 unmodified lines
101void WelsFree (void* pPointer, const char* kpTag) {102void WelsFree (void* pPointer, const char* kpTag) {
102 if (pPointer) {103 if (pPointer) {
103#ifdef MEMORY_CHECK104#ifdef MEMORY_CHECK
104 if (m_fpMemChkPoint != NULL) {105 if (fpMemChkPoint != NULL) {
105 if (kpTag != NULL)106 if (kpTag != NULL)
106 fprintf (fpMemChkPoint, "WelsFree(), 0x%x - %s: \t%d\t bytes \n", (void*) (* (((void**) pPointer) - 1)), kpTag,107 fprintf (fpMemChkPoint, "WelsFree(), 0x%x - %s: \t%d\t bytes \n", (void*) (* (((void**) pPointer) - 1)), kpTag,
107 kiMemoryLength);108 iMemoryLength);
108 else109 else
109 fprintf (fpMemChkPoint, "WelsFree(), 0x%x \n", (void*) (* (((void**) pPointer) - 1)));110 fprintf (fpMemChkPoint, "WelsFree(), 0x%x \n", (void*) (* (((void**) pPointer) - 1)));
110 fflush (fpMemChkPoint);111 fflush (fpMemChkPoint);
@@ -129,9 +130,9 @@ void* CMemoryAlign::WelsMalloc (const uint32_t kuiSize, const char* kpTag) { · 18 unmodified lines
129 void* pPointer = WelsCommon::WelsMalloc (kuiSize, kpTag, m_nCacheLineSize);130 void* pPointer = WelsCommon::WelsMalloc (kuiSize, kpTag, m_nCacheLineSize);
130#ifdef MEMORY_MONITOR131#ifdef MEMORY_MONITOR
131 if (pPointer != NULL) {132 if (pPointer != NULL) {
132 const int32_t kiMemoryLength = * ((int32_t*) ((uint8_t*)pPointer - sizeof (void**) - sizeof (133 const int32_t iMemoryLength = * ((int32_t*) ((uint8_t*)pPointer - sizeof (void**) - sizeof (
133 int32_t))) + m_nCacheLineSize - 1 + sizeof (void**) + sizeof (int32_t);134 int32_t))) + m_nCacheLineSize - 1 + sizeof (void**) + sizeof (int32_t);
134 m_nMemoryUsageInBytes += kiMemoryLength;135 m_nMemoryUsageInBytes += iMemoryLength;
135 }136 }
136#endif//MEMORY_MONITOR137#endif//MEMORY_MONITOR
137 return pPointer;138 return pPointer;
@@ -140,9 +141,9 @@ void* CMemoryAlign::WelsMalloc (const uint32_t kuiSize, const char* kpTag) { · 2 unmodified lines
140void CMemoryAlign::WelsFree (void* pPointer, const char* kpTag) {141void CMemoryAlign::WelsFree (void* pPointer, const char* kpTag) {
141 if (pPointer) {142 if (pPointer) {
142#ifdef MEMORY_MONITOR143#ifdef MEMORY_MONITOR
143 const int32_t kiMemoryLength = * ((int32_t*) ((uint8_t*)pPointer - sizeof (void**) - sizeof (144 const int32_t iMemoryLength = * ((int32_t*) ((uint8_t*)pPointer - sizeof (void**) - sizeof (
144 int32_t))) + m_nCacheLineSize - 1 + sizeof (void**) + sizeof (int32_t);145 int32_t))) + m_nCacheLineSize - 1 + sizeof (void**) + sizeof (int32_t);
145 m_nMemoryUsageInBytes -= kiMemoryLength;146 m_nMemoryUsageInBytes -= iMemoryLength;
146#endif//MEMORY_MONITOR147#endif//MEMORY_MONITOR
147 }148 }
148 WelsCommon::WelsFree (pPointer, kpTag);149 WelsCommon::WelsFree (pPointer, kpTag);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t