hotfix 3221ac0943 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.
This commit is contained in:
parent
cd65ef0056
commit
ed4f1f4c43
1 changed files with 2 additions and 1 deletions
|
|
@ -562,7 +562,8 @@ else:
|
||||||
when not declared(nimNewSeqOfCap):
|
when not declared(nimNewSeqOfCap):
|
||||||
proc nimNewSeqOfCap(typ: PNimType, cap: int): pointer {.compilerproc.} =
|
proc nimNewSeqOfCap(typ: PNimType, cap: int): pointer {.compilerproc.} =
|
||||||
when defined(gcRegions):
|
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:
|
else:
|
||||||
let s = addInt(mulInt(cap, typ.base.size), GenericSeqSize)
|
let s = addInt(mulInt(cap, typ.base.size), GenericSeqSize)
|
||||||
when declared(newObjNoInit):
|
when declared(newObjNoInit):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue