MCPcopy Create free account
hub / github.com/beefytech/Beef / DbgHeapFree

Function DbgHeapFree

BeefySysLib/util/AllocDebug.cpp:307–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305}
306
307void 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

Callers 2

operator deleteFunction · 0.85
operator delete[]Function · 0.85

Calls 2

DbgHeapHashMemoryFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected