|
|
@ -68,6 +68,7 @@ public static class TempAllocator |
|
|
|
|
|
|
|
|
|
|
|
public ResetOnDispose(ArenaAllocator allocator, int start) |
|
|
|
public ResetOnDispose(ArenaAllocator allocator, int start) |
|
|
|
{ _allocator = allocator; _start = start; } |
|
|
|
{ _allocator = allocator; _start = start; } |
|
|
|
|
|
|
|
|
|
|
|
// TODO: Print warning in finalizer if Dispose wasn't called manually. |
|
|
|
// TODO: Print warning in finalizer if Dispose wasn't called manually. |
|
|
|
|
|
|
|
|
|
|
|
// IAllocator implementation |
|
|
|
// IAllocator implementation |
|
|
@ -90,7 +91,7 @@ public class GlobalHeapAllocator |
|
|
|
=> Marshal.FreeHGlobal(pointer); |
|
|
|
=> Marshal.FreeHGlobal(pointer); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public sealed class ArenaAllocator |
|
|
|
public class ArenaAllocator |
|
|
|
: IAllocator |
|
|
|
: IAllocator |
|
|
|
, IDisposable |
|
|
|
, IDisposable |
|
|
|
{ |
|
|
|
{ |
|
|
@ -133,7 +134,7 @@ public sealed class ArenaAllocator |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public sealed class RingAllocator |
|
|
|
public class RingAllocator |
|
|
|
: IAllocator |
|
|
|
: IAllocator |
|
|
|
, IDisposable |
|
|
|
, IDisposable |
|
|
|
{ |
|
|
|
{ |
|
|
@ -166,5 +167,5 @@ public sealed class RingAllocator |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void Free(nint pointer) |
|
|
|
public void Free(nint pointer) |
|
|
|
{ /* IGNORE */ } |
|
|
|
{ /* Do nothing. */ } |
|
|
|
} |
|
|
|
} |
|
|
|