fixes #7833; still to-do: fix setLen

This commit is contained in:
Araq 2018-07-30 23:27:01 +02:00
commit 53566f7165
4 changed files with 17 additions and 10 deletions

View file

@ -548,7 +548,10 @@ proc growObj(old: pointer, newsize: int, gch: var GcHeap): pointer =
gcTrace(res, csAllocated)
track("growObj old", ol, 0)
track("growObj new", res, newsize)
when reallyDealloc:
when defined(nimIncrSeqV3):
# since we steal the old seq's contents, we set the old length to 0.
cast[PGenericSeq](old).len = 0
elif reallyDealloc:
sysAssert(allocInv(gch.region), "growObj before dealloc")
if ol.refcount shr rcShift <=% 1:
# free immediately to save space: