feat(lowlevel): add VirtualStack, update allocators, docs
Introduce VirtualStack allocator, refactor memory management to use virtual memory stacks, and update documentation. Added VirtualStack as a new stack allocator using virtual memory, replaced Stack with VirtualStack in allocation manager and related APIs, and updated TempJobAllocator to use VirtualArena. Introduced AllocationManagerInitOpts for allocator configuration. Replaced ENABLE_COLLECTION_CHECKS with ENABLE_SAFETY_CHECKS for safety checks. Removed Result.cs and updated project files and examples. Added comprehensive README files for all major packages and improved root documentation. BREAKING CHANGE: Stack allocator replaced by VirtualStack; TempJobAllocator and AllocationManager initialization signatures changed; Result types removed.
This commit is contained in:
@@ -6,8 +6,17 @@ namespace Misaki.HighPerformance.LowLevel.Buffer;
|
||||
/// <summary>
|
||||
/// A thread-safe memory management structure that reserves a large virtual address space and commits physical memory on demand as allocations are made.
|
||||
/// </summary>
|
||||
public unsafe struct VirtualArena
|
||||
public unsafe struct VirtualArena : IMemoryAllocator<VirtualArena, VirtualArena.CreationOptions>
|
||||
{
|
||||
public struct CreationOptions
|
||||
{
|
||||
public nuint reserveCapacity;
|
||||
}
|
||||
public static VirtualArena Create(in CreationOptions opts)
|
||||
{
|
||||
return new VirtualArena(opts.reserveCapacity);
|
||||
}
|
||||
|
||||
private const nuint _PAGE_SIZE = 64 * 1024;
|
||||
|
||||
private byte* _baseAddress;
|
||||
@@ -95,6 +104,11 @@ public unsafe struct VirtualArena
|
||||
return ptr;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly void Free(void* ptr)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the arena.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user