GC: added static cycleGC checks
This commit is contained in:
parent
6f1fc1b5ba
commit
3940bd5b84
1 changed files with 6 additions and 4 deletions
|
|
@ -173,9 +173,10 @@ proc rtlAddCycleRoot(c: PCell) {.rtl, inl.} =
|
||||||
# we MUST access gch as a global here, because this crosses DLL boundaries!
|
# we MUST access gch as a global here, because this crosses DLL boundaries!
|
||||||
when hasThreadSupport and hasSharedHeap:
|
when hasThreadSupport and hasSharedHeap:
|
||||||
AcquireSys(HeapLock)
|
AcquireSys(HeapLock)
|
||||||
if c.color != rcPurple:
|
when cycleGC:
|
||||||
c.setColor(rcPurple)
|
if c.color != rcPurple:
|
||||||
incl(gch.cycleRoots, c)
|
c.setColor(rcPurple)
|
||||||
|
incl(gch.cycleRoots, c)
|
||||||
when hasThreadSupport and hasSharedHeap:
|
when hasThreadSupport and hasSharedHeap:
|
||||||
ReleaseSys(HeapLock)
|
ReleaseSys(HeapLock)
|
||||||
|
|
||||||
|
|
@ -811,7 +812,8 @@ proc CollectZCT(gch: var TGcHeap): bool =
|
||||||
# as this might be too slow.
|
# as this might be too slow.
|
||||||
# In any case, it should be removed from the ZCT. But not
|
# In any case, it should be removed from the ZCT. But not
|
||||||
# freed. **KEEP THIS IN MIND WHEN MAKING THIS INCREMENTAL!**
|
# freed. **KEEP THIS IN MIND WHEN MAKING THIS INCREMENTAL!**
|
||||||
if canBeCycleRoot(c): excl(gch.cycleRoots, c)
|
when cycleGC:
|
||||||
|
if canBeCycleRoot(c): excl(gch.cycleRoots, c)
|
||||||
when logGC: writeCell("zct dealloc cell", c)
|
when logGC: writeCell("zct dealloc cell", c)
|
||||||
gcTrace(c, csZctFreed)
|
gcTrace(c, csZctFreed)
|
||||||
# We are about to free the object, call the finalizer BEFORE its
|
# We are about to free the object, call the finalizer BEFORE its
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue