Better handling when size is 0
This commit is contained in:
@@ -58,6 +58,11 @@ public readonly struct MemoryHandle : IDisposable, IEquatable<MemoryHandle>
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!IsInvalid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AllocationManager.RemoveAllocation(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,11 @@ public unsafe struct MemoryBlock : IDisposable
|
||||
|
||||
public MemoryBlock(nuint size, nuint alignment, AllocationHandle handle, AllocationOption allocationOption = AllocationOption.None)
|
||||
{
|
||||
if (size == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_buffer = handle.Alloc(size, alignment, allocationOption);
|
||||
_size = size;
|
||||
_alignment = alignment;
|
||||
|
||||
Reference in New Issue
Block a user