diff options
-rw-r--r-- | compiler/ccgexprs.nim | 2 | ||||
-rw-r--r-- | doc/manual.txt | 2 | ||||
-rw-r--r-- | tests/gc/gcleak4.nim | 2 | ||||
-rw-r--r-- | tests/gc/gcleak5.nim | 25 | ||||
-rw-r--r-- | tests/testament/categories.nim | 5 | ||||
-rw-r--r-- | todo.txt | 2 |
6 files changed, 35 insertions, 3 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index be47ac0c4..031ab8d70 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1049,7 +1049,7 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) = app(tmp2.r, field.loc.r) tmp2.k = locTemp tmp2.t = field.loc.t - tmp2.s = OnHeap + tmp2.s = if isRef: OnHeap else: OnStack tmp2.heapRoot = tmp.r expr(p, it.sons[1], tmp2) if d.k == locNone: diff --git a/doc/manual.txt b/doc/manual.txt index da229d169..520e4f62e 100644 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -2231,6 +2231,8 @@ Instead of: Using statement --------------- +**Warning**: The ``using`` statement is highly experimental! + The `using statement`:idx: provides syntactic convenience for procs that heavily use a single contextual parameter. When applied to a variable or a constant, it will instruct Nimrod to automatically consider the used symbol as diff --git a/tests/gc/gcleak4.nim b/tests/gc/gcleak4.nim index bd7bded28..6f2b8a1fe 100644 --- a/tests/gc/gcleak4.nim +++ b/tests/gc/gcleak4.nim @@ -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 diff --git a/tests/gc/gcleak5.nim b/tests/gc/gcleak5.nim new file mode 100644 index 000000000..b9131051b --- /dev/null +++ b/tests/gc/gcleak5.nim @@ -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() diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim index 5dd841447..f9f5698bb 100644 --- a/tests/testament/categories.nim +++ b/tests/testament/categories.nim @@ -123,9 +123,14 @@ proc gcTests(r: var TResults, cat: Category, options: string) = test "gcleak2" test "gctest" test "gcleak3" + test "gcleak4" + test "gcleak5" test "weakrefs" test "cycleleak" test "closureleak" + test "refarrayleak" + rest "stackrefleak" + # ------------------------- threading tests ----------------------------------- diff --git a/todo.txt b/todo.txt index a9f2e80e5..738e9b3fa 100644 --- a/todo.txt +++ b/todo.txt @@ -5,7 +5,7 @@ version 0.9.4 - fix macros\tstringinterp.nim - test and fix showoff - test C source code generation -- test and fix closures +- fix closures - test and fix exception handling - implement 'union' and 'bits' pragmas |