From ed4f1f4c4368238efc1686189e04e87b419e276a Mon Sep 17 00:00:00 2001 From: Charles Blake Date: Wed, 13 Jun 2018 10:36:47 -0400 Subject: [PATCH] hotfix 3221ac094398492e09ea618638204793b0990eca broke gc:regions/aka gc:stack by underallocating for sequences of any type larger than 1 byte. This does the necessary multiply to restore basic functionality. --- lib/system/mmdisp.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/system/mmdisp.nim b/lib/system/mmdisp.nim index 2c9b1e5021..b33ca93f26 100644 --- a/lib/system/mmdisp.nim +++ b/lib/system/mmdisp.nim @@ -562,7 +562,8 @@ else: when not declared(nimNewSeqOfCap): proc nimNewSeqOfCap(typ: PNimType, cap: int): pointer {.compilerproc.} = when defined(gcRegions): - result = newStr(typ, cap, ntfNoRefs notin typ.base.flags) + let s = mulInt(cap, typ.base.size) # newStr already adds GenericSeqSize + result = newStr(typ, s, ntfNoRefs notin typ.base.flags) else: let s = addInt(mulInt(cap, typ.base.size), GenericSeqSize) when declared(newObjNoInit):