summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-04-21 16:38:25 +0200
committerAraq <rumpf_a@web.de>2012-04-21 16:38:25 +0200
commit7e7c514dfcb6fcd83356ecadf5fec5526d7c332d (patch)
treeca0ad40a57c54eb69b3dd02e46f91606bc191ab5 /lib/system
parent7511a05b27e919c61703fea31f8d6d99cb2eae05 (diff)
downloadNim-7e7c514dfcb6fcd83356ecadf5fec5526d7c332d.tar.gz
documentation improvements; GC_step improved
Diffstat (limited to 'lib/system')
-rwxr-xr-xlib/system/gc.nim12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/system/gc.nim b/lib/system/gc.nim
index 1fdb1d335..ea30754a6 100755
--- a/lib/system/gc.nim
+++ b/lib/system/gc.nim
@@ -856,15 +856,11 @@ when withRealtime:
 
   proc GC_step(gch: var TGcHeap, us: int, strongAdvice: bool) =
     acquire(gch)
-    var oldThreshold = gch.cycleThreshold
-    # disable cycle collection:
-    gch.cycleThreshold = high(gch.cycleThreshold)-1
     gch.maxPause = us.toNano
-    if strongAdvice:
-      if gch.recGcLock == 0: collectCTBody(gch)
-    else:
-      collectCT(gch)
-    gch.cycleThreshold = oldThreshold
+    if (gch.zct.len >= ZctThreshold or (cycleGC and
+        getOccupiedMem(gch.region)>=gch.cycleThreshold) or alwaysGC) or 
+        strongAdvice:
+      collectCTBody(gch)
     release(gch)
 
   proc GC_step*(us: int, strongAdvice = false) = GC_step(gch, us, strongAdvice)