From 9928b9f48de5b5d8077701ee7f64b9d9f49de3ab Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Mon, 7 Mar 2016 22:38:22 +0800 Subject: [PATCH] newObj can clear memory, even when using malloc and nogc --- lib/system/mmdisp.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/system/mmdisp.nim b/lib/system/mmdisp.nim index 1e85853d1c..4b01cf4a87 100644 --- a/lib/system/mmdisp.nim +++ b/lib/system/mmdisp.nim @@ -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