|
|
|
|
|
by kaibutsu
261 days ago
|
|
You can write an arena allocator referencing a pointer allocated via Marshal.AllocHGlobal and proxying it via Span<T> very easily in literally like 30 lines of code which will achieve whatever you're suggesting there, can also add where T: unmanaged if you don't want the ability to reference things which can be tracked by the GC, this is already possible right now and is fully enforced. You can add 30 more lines of code to your arena with some PInvoking on windows calling AddVectoredExceptionHandler and VirtualAlloc, which will allow you to allocate whatever amount of memory you'd like without actually committing it, creating a very optimized and easy to use alternative to whatever you're suggesting. |
|