ARC: fixes memory leaks with newSeq used in a loop [backport:1.4] (#18040)
* ARC: fixes memory leaks with newSeq used in a loop [backport:1.4] * Update tests/arc/tnewseq_legacy.nim
This commit is contained in:
parent
31143c68fc
commit
53935b8b27
3 changed files with 23 additions and 1 deletions
13
tests/arc/tnewseq_legacy.nim
Normal file
13
tests/arc/tnewseq_legacy.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
discard """
|
||||
output: "(allocCount: 201, deallocCount: 201)"
|
||||
cmd: "nim c --gc:orc -d:nimAllocStats $file"
|
||||
"""
|
||||
|
||||
proc main(prefix: string) =
|
||||
var c: seq[string]
|
||||
for i in 0..<100:
|
||||
newSeq(c, 100)
|
||||
c[i] = prefix & $i
|
||||
|
||||
main("abc")
|
||||
echo getAllocStats()
|
||||
Loading…
Add table
Add a link
Reference in a new issue