From 973b5e73cfdff00736ad5d9962602a5402df07f3 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 25 Nov 2019 06:46:14 -0800 Subject: [PATCH] Fixed custom allocators when recording >1 allocation stack depth --- BeefLibs/corlib/src/Internal.bf | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/BeefLibs/corlib/src/Internal.bf b/BeefLibs/corlib/src/Internal.bf index b3ae5134..1d1e6de2 100644 --- a/BeefLibs/corlib/src/Internal.bf +++ b/BeefLibs/corlib/src/Internal.bf @@ -51,8 +51,10 @@ namespace System public static extern void ObjectDynCheck(Object obj, int32 typeId, bool allowNull); public static extern void ObjectDynCheckFailed(Object obj, int32 typeId); public static extern void Dbg_ObjectCreated(Object obj, int size, ClassVData* classVData); + public static extern void Dbg_ObjectCreatedEx(Object obj, int size, ClassVData* classVData); public static extern void Dbg_ObjectAllocated(Object obj, int size, ClassVData* classVData); - public static extern int Dbg_PrepareStackTrace(int maxDepth); + public static extern void Dbg_ObjectAllocatedEx(Object obj, int size, ClassVData* classVData); + public static extern int Dbg_PrepareStackTrace(int baseAllocSize, int maxStackTraceDepth); public static extern void Dbg_ObjectStackInit(Object object, ClassVData* classVData); public static extern Object Dbg_ObjectAlloc(TypeInstance typeInst, int size); public static extern Object Dbg_ObjectAlloc(ClassVData* classVData, int size, int align, int maxStackTraceDepth); @@ -250,4 +252,22 @@ namespace System extern static this(); extern static ~this(); } + + struct CRTAlloc + { + public void* Alloc(int size, int align) + { + return Internal.StdMalloc(size); + } + + public void Free(void* ptr) + { + Internal.StdFree(ptr); + } + } + + static + { + public static CRTAlloc gCRTAlloc; + } }