Merge pull request #3952 from arnetheduck/alloc0-nogc-malloc
newObj can clear memory, even when using malloc and nogc
This commit is contained in:
commit
3be1c6f796
1 changed files with 1 additions and 1 deletions
|
|
@ -427,7 +427,7 @@ elif defined(nogc) and defined(useMalloc):
|
|||
proc initGC() = discard
|
||||
|
||||
proc newObj(typ: PNimType, size: int): pointer {.compilerproc.} =
|
||||
result = alloc(size)
|
||||
result = alloc0(size)
|
||||
proc newSeq(typ: PNimType, len: int): pointer {.compilerproc.} =
|
||||
result = newObj(typ, addInt(mulInt(len, typ.base.size), GenericSeqSize))
|
||||
cast[PGenericSeq](result).len = len
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue