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

Improvements to Queue, to bring it more inline with List

This commit is contained in:
Brian Fiete 2020-03-20 09:26:16 -07:00
parent 69cb6d0208
commit 96c53d4a9e
5 changed files with 238 additions and 88 deletions

View file

@ -8,6 +8,17 @@ namespace System
public Type mType;
public void* mMarkFunc;
public int32 mMaxStackTrace;
public struct Unmarked<T>
{
public static DbgRawAllocData sRawAllocData;
public static this()
{
sRawAllocData.mMarkFunc = null;
sRawAllocData.mMaxStackTrace = 1;
sRawAllocData.mType = typeof(T);
}
}
}
[AlwaysInclude]
@ -81,6 +92,17 @@ namespace System
sModuleHandle = handle;
}
public static T* AllocRawArrayUnmarked<T>(int size)
{
#if BF_ENABLE_REALTIME_LEAK_CHECK
// We don't want to use the default mark function because the GC will mark the entire array,
// whereas we have a custom marking routine because we only want to mark up to mSize
return (T*)Internal.Dbg_RawAlloc(size * strideof(T), &DbgRawAllocData.Unmarked<T>.sRawAllocData);
#else
return new T[size]*(?);
#endif
}
public static Object ObjectAlloc(TypeInstance typeInst, int size)
{
#if BF_ENABLE_OBJECT_DEBUG_FLAGS