bugfix: codegen issue that caused getGMTime() to leak memory
This commit is contained in:
parent
3be07d842a
commit
a087f6057e
6 changed files with 35 additions and 3 deletions
|
|
@ -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
25
tests/gc/gcleak5.nim
Normal 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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue