| 305 | } |
| 306 | |
| 307 | void DbgHeapFree(const void* ptr, const char* fileName, int lineNum) |
| 308 | { |
| 309 | if (ptr == NULL) |
| 310 | return; |
| 311 | |
| 312 | bool found = false; |
| 313 | |
| 314 | for (int i = 0; i < (int) gDbgHeapRecords.size(); i++) |
| 315 | { |
| 316 | auto& allocRecord = gDbgHeapRecords[i]; |
| 317 | if (allocRecord.mPtr + ALLOC_PADDING == ptr) |
| 318 | { |
| 319 | assert(allocRecord.mFreeTransactionIdx == 0); |
| 320 | |
| 321 | gDbgHeapFreedBytes += allocRecord.mSize; |
| 322 | allocRecord.mFreeFileName = fileName; |
| 323 | allocRecord.mFreeLineNum = lineNum; |
| 324 | allocRecord.mFreeTransactionIdx = gDbgHeapTransactionIdx++;; |
| 325 | allocRecord.mHashAtFree = DbgHeapHashMemory(allocRecord.mPtr + ALLOC_PADDING, allocRecord.mSize); |
| 326 | return; |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | assert("Not found" == 0); |
| 331 | } |
| 332 | |
| 333 | #endif |
| 334 |
no test coverage detected