Showing the changes to codec/common/src/memory_align.cpp (1 of 1 file). Show all
Unified · Split
| @@ -40,6 +40,7 @@ namespace WelsCommon { · 39 unmodified lines | ||
| 40 | 40 | #ifdef MEMORY_CHECK |
| 41 | 41 | static FILE* fpMemChkPoint; |
| 42 | 42 | static uint32_t nCountRequestNum; |
| 43 | +static int32_t iMemoryLength; | |
| 43 | 44 | #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 | 72 | uint8_t* pBuf = (uint8_t*) malloc (kiActualRequestedSize); |
| 72 | 73 | #ifdef MEMORY_CHECK |
| 73 | 74 | if (fpMemChkPoint == NULL) { |
| 74 | − m_fpMemChkPoint = fopen ("./enc_mem_check_point.txt", "at+"); | |
| 75 | − m_nCountRequestNum = 0; | |
| 75 | + fpMemChkPoint = fopen ("./enc_mem_check_point.txt", "at+"); | |
| 76 | + nCountRequestNum = 0; | |
| 76 | 77 | } |
| 77 | 78 | |
| 78 | 79 | if (fpMemChkPoint != NULL) { |
| @@ -101,10 +102,10 @@ void* WelsMalloc (const uint32_t kuiSize, const char* kpTag, const uint32_t kiAl · 22 unmodified lines | ||
| 101 | 102 | void WelsFree (void* pPointer, const char* kpTag) { |
| 102 | 103 | if (pPointer) { |
| 103 | 104 | #ifdef MEMORY_CHECK |
| 104 | − if (m_fpMemChkPoint != NULL) { | |
| 105 | + if (fpMemChkPoint != NULL) { | |
| 105 | 106 | if (kpTag != NULL) |
| 106 | 107 | fprintf (fpMemChkPoint, "WelsFree(), 0x%x - %s: \t%d\t bytes \n", (void*) (* (((void**) pPointer) - 1)), kpTag, |
| 107 | − kiMemoryLength); | |
| 108 | + iMemoryLength); | |
| 108 | 109 | else |
| 109 | 110 | fprintf (fpMemChkPoint, "WelsFree(), 0x%x \n", (void*) (* (((void**) pPointer) - 1))); |
| 110 | 111 | fflush (fpMemChkPoint); |
| @@ -129,9 +130,9 @@ void* CMemoryAlign::WelsMalloc (const uint32_t kuiSize, const char* kpTag) { · 18 unmodified lines | ||
| 129 | 130 | void* pPointer = WelsCommon::WelsMalloc (kuiSize, kpTag, m_nCacheLineSize); |
| 130 | 131 | #ifdef MEMORY_MONITOR |
| 131 | 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 | 134 | int32_t))) + m_nCacheLineSize - 1 + sizeof (void**) + sizeof (int32_t); |
| 134 | − m_nMemoryUsageInBytes += kiMemoryLength; | |
| 135 | + m_nMemoryUsageInBytes += iMemoryLength; | |
| 135 | 136 | } |
| 136 | 137 | #endif//MEMORY_MONITOR |
| 137 | 138 | return pPointer; |
| @@ -140,9 +141,9 @@ void* CMemoryAlign::WelsMalloc (const uint32_t kuiSize, const char* kpTag) { · 2 unmodified lines | ||
| 140 | 141 | void CMemoryAlign::WelsFree (void* pPointer, const char* kpTag) { |
| 141 | 142 | if (pPointer) { |
| 142 | 143 | #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 | 145 | int32_t))) + m_nCacheLineSize - 1 + sizeof (void**) + sizeof (int32_t); |
| 145 | − m_nMemoryUsageInBytes -= kiMemoryLength; | |
| 146 | + m_nMemoryUsageInBytes -= iMemoryLength; | |
| 146 | 147 | #endif//MEMORY_MONITOR |
| 147 | 148 | } |
| 148 | 149 | WelsCommon::WelsFree (pPointer, kpTag); |