bugfix: codegen issue that caused getGMTime() to leak memory

This commit is contained in:
Araq 2014-02-07 17:06:20 +01:00
commit a087f6057e
6 changed files with 35 additions and 3 deletions

View file

@ -6,7 +6,7 @@ when defined(GC_setMaxPause):
GC_setMaxPause 2_000
type
TExpr = object ## abstract base class for an expression
TExpr = object {.inheritable.} ## abstract base class for an expression
PLiteral = ref TLiteral
TLiteral = object of TExpr
x: int

25
tests/gc/gcleak5.nim Normal file
View file

@ -0,0 +1,25 @@
discard """
output: "success"
"""
import os, times
proc main =
var i = 0
for ii in 0..50_000:
#while true:
var t = getTime()
var g = t.getGMTime()
#echo isOnStack(addr g)
if i mod 100 == 0:
let om = getOccupiedMem()
echo "memory: ", om
if om > 100_000: quit "leak"
inc(i)
sleep(1)
echo "success"
main()