This commit is contained in:
ringabout
2026-02-02 17:47:26 +08:00
parent d6e016f6ae
commit 53c048744c
2 changed files with 40 additions and 38 deletions

View File

@@ -778,7 +778,9 @@ proc deallocBigChunk(a: var MemRegion, c: PBigChunk) =
sysAssert a.occ >= 0, "rawDealloc: negative occupied memory (case B)"
when not defined(gcDestructors):
a.deleted = getBottom(a)
del(a, a.root, cast[int](addr(c.data)))
# Use the same address that was added during allocation (accounting for alignment)
let alignedDataAddr = cast[int](addr(c.data)) +% c.alignOffset.int
del(a, a.root, alignedDataAddr)
if c.size >= HugeChunkSize: freeHugeChunk(a, c)
else: freeBigChunk(a, c)