Merge pull request #3952 from arnetheduck/alloc0-nogc-malloc

newObj can clear memory, even when using malloc and nogc
This commit is contained in:
Andreas Rumpf 2016-03-07 18:31:11 +01:00
commit 3be1c6f796

View file

@ -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