WIP: Removed internal header tracking for WorkspaceHeap. Modified Handles to track the alignment that the underlying memory was aligned to. Re-worked WorkspaceHeap to use lists rather than Stack
This commit is contained in:
@@ -291,7 +291,7 @@
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown if <paramref name="segmentSize"/> is zero, or if <paramref name="initialSegments"/> is less than 1.
|
||||
/// </exception>
|
||||
public SegmentedPool(nuint segmentSize = _defaultSegmentSize, SegmentAlignment segmentAlignment = SegmentAlignment.Aligned32, int initialSegments = 4, bool zeroMemory = false)
|
||||
public SegmentedPool(nuint segmentSize = _defaultSegmentSize, SegmentAlignment segmentAlignment = SegmentAlignment.Aligned16, int initialSegments = 4, bool zeroMemory = false)
|
||||
: this(segmentSize, segmentAlignment, initialSegments, zeroMemory, new DefaultUnmanagedAllocator())
|
||||
{
|
||||
}
|
||||
@@ -620,7 +620,9 @@
|
||||
{
|
||||
T* ptr = Alloc<T>(count);
|
||||
nuint byteLength = (nuint)count * (nuint)sizeof(T);
|
||||
return new SegmentedMemoryHandle<T>(ptr, byteLength, this);
|
||||
|
||||
nuint alignment = _segmentAlignment > (nuint)sizeof(T) ? _segmentAlignment : (nuint)sizeof(T);
|
||||
return new SegmentedMemoryHandle<T>(ptr, byteLength, alignment, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -651,7 +653,7 @@
|
||||
|
||||
T* ptr = AllocateWithAlignment<T>(count, effectiveAlignment);
|
||||
nuint byteLength = (nuint)count * (nuint)sizeof(T);
|
||||
return new SegmentedMemoryHandle<T>(ptr, byteLength, this);
|
||||
return new SegmentedMemoryHandle<T>(ptr, byteLength, effectiveAlignment, this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user