diff options
author | Araq <rumpf_a@web.de> | 2018-07-30 23:27:01 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-07-30 23:27:01 +0200 |
commit | 53566f716501fe906b8b2aa4ce050be5d6eb0364 (patch) | |
tree | 01dfe04aaa07746d1ed005624ae7a100e3634eb7 /lib/system | |
parent | f2ddd995393bc485880d3e56b277bad6448ad0c3 (diff) | |
download | Nim-53566f716501fe906b8b2aa4ce050be5d6eb0364.tar.gz |
fixes #7833; still to-do: fix setLen
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/gc.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/system/gc.nim b/lib/system/gc.nim index 425963f3f..74ac68eea 100644 --- a/lib/system/gc.nim +++ b/lib/system/gc.nim @@ -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: |