From 76179cbec287314831afd5e45f49cbfd8e9111c8 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Fri, 15 Nov 2019 12:38:11 +0100 Subject: ARC: fixes leaking new() statement (#12665) --- tests/destructor/tlists.nim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/destructor/tlists.nim b/tests/destructor/tlists.nim index a9c78ab75..78c09b105 100644 --- a/tests/destructor/tlists.nim +++ b/tests/destructor/tlists.nim @@ -43,9 +43,18 @@ proc tlazyList = var x = LazyList(c: proc () = echo(dep)) x.c() +type + Foo = ref object + +proc tleakingNewStmt = + var x: Foo + for i in 0..10: + new(x) + let startMem = getOccupiedMem() tlazyList() mkManyLeaks() tsimpleClosureIterator() +tleakingNewStmt() echo getOccupiedMem() - startMem -- cgit 1.4.1-2-gfad0