1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed leak checking for >1 stack trace depth

This commit is contained in:
Brian Fiete 2020-07-11 16:22:37 -07:00
parent a1c8d60d4b
commit 5cb6570e14

View file

@ -386,25 +386,25 @@ bf::System::Object* Internal::Dbg_ObjectAlloc(bf::System::ClassVData* classVData
intptr dbgAllocInfo;
auto classVDataVal = (intptr)classVData | (intptr)BfObjectFlag_Allocated;
result->mClassVData = classVDataVal;
if (maxStackTraceDepth <= 1)
dbgAllocInfo = (intptr)BF_RETURN_ADDRESS;
else
{
if (largeAllocInfo)
{
result->mClassVData |= (intptr)BfObjectFlag_AllocInfo;
classVDataVal |= (intptr)BfObjectFlag_AllocInfo;
dbgAllocInfo = size;
*(intptr*)((uint8*)result + size) = capturedTraceCount;
memcpy((uint8*)result + size + sizeof(intptr), stackTrace, capturedTraceCount * sizeof(intptr));
}
else
{
result->mClassVData |= (intptr)BfObjectFlag_AllocInfo_Short;
classVDataVal |= (intptr)BfObjectFlag_AllocInfo_Short;
dbgAllocInfo = (size << 16) | capturedTraceCount;
memcpy((uint8*)result + size, stackTrace, capturedTraceCount * sizeof(intptr));
}
}
result->mClassVData = classVDataVal;
BF_FULL_MEMORY_FENCE(); // Since we depend on mDbAllocInfo to determine if we are allocated, we need to set this last after we're set up
result->mDbgAllocInfo = dbgAllocInfo;
BF_FULL_MEMORY_FENCE();