diff options
-rw-r--r-- | lib/system/mmdisp.nim | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/system/mmdisp.nim b/lib/system/mmdisp.nim index d2160fdac..824934966 100644 --- a/lib/system/mmdisp.nim +++ b/lib/system/mmdisp.nim @@ -564,7 +564,11 @@ else: when not declared(nimNewSeqOfCap): proc nimNewSeqOfCap(typ: PNimType, cap: int): pointer {.compilerproc.} = - result = newObj(typ, addInt(mulInt(cap, typ.base.size), GenericSeqSize)) + let s = addInt(mulInt(cap, typ.base.size), GenericSeqSize) + when declared(newObjNoInit): + result = if ntfNoRefs in typ.base.flags: newObjNoInit(typ, s) else: newObj(typ, s) + else: + result = newObj(typ, s) cast[PGenericSeq](result).len = 0 cast[PGenericSeq](result).reserved = cap |