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