documentation improvements; GC_step improved

This commit is contained in:
Araq 2012-04-21 16:38:25 +02:00
commit 7e7c514dfc
8 changed files with 68 additions and 23 deletions

View file

@ -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.}

View file

@ -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)