fix(freelist): ensure at least one block is created

Updated FreeList allocator to guarantee at least one block is created per chunk by using Math.Max(1u, ...), and capped the number of blocks at 256. This prevents blocksToCreate from being zero and improves allocator robustness.

Bumped assembly version to 1.6.3.
This commit is contained in:
2026-03-31 20:40:41 +09:00
parent abb0cd88ea
commit 4d3ba9927c
2 changed files with 4 additions and 2 deletions

View File

@@ -385,7 +385,9 @@ public unsafe struct FreeList : IMemoryAllocator<FreeList, FreeList.CreationOpts
}
var blockSize = bucket->blockSize;
var blocksToCreate = Math.Min(_chunkSize / blockSize, 256);
var blocksToCreate = Math.Max(1u, _chunkSize / blockSize);
blocksToCreate = Math.Min(blocksToCreate, 256);
if (blocksToCreate == 0)
{
return false;