summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/system.nim4
-rwxr-xr-xlib/system/gc.nim12
2 files changed, 6 insertions, 10 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 128ec921c..ae6e4dc9f 100755
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -807,7 +807,6 @@ const
   taintMode = compileOption("taintmode")
 
 when taintMode:
-  # XXX use a compile time option for it!
   type TaintedString* = distinct string ## a distinct string type that 
                                         ## is `tainted`:idx:. It is an alias for
                                         ## ``string`` if the taint mode is not
@@ -1486,8 +1485,9 @@ type
     gcOptimizeTime,    ## optimize for speed
     gcOptimizeSpace    ## optimize for memory footprint
 
-proc GC_setStrategy*(strategy: TGC_Strategy) {.rtl.}
+proc GC_setStrategy*(strategy: TGC_Strategy) {.rtl, deprecated.}
   ## tells the GC the desired strategy for the application.
+  ## **Deprecated** since version 0.8.14. This has always been a nop.
 
 proc GC_enableMarkAndSweep*() {.rtl.}
 proc GC_disableMarkAndSweep*() {.rtl.}
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)