Skip to content

Comment on Conservative GC can be faster than precise GCparent

Comments

Some are not. You can try this:

    diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go
    index a2b6b979c1..d2f2852294 100644
    --- a/src/runtime/mgc.go
    +++ b/src/runtime/mgc.go
    @@ -144,7 +144,7 @@ const (
     
      // debugScanConservative enables debug logging for stack
      // frames that are scanned conservatively.
    - debugScanConservative = false
    + debugScanConservative = true
     
      // sweepMinHeapDistance is a lower bound on the heap distance
      // (in bytes) reserved for concurrent sweeping between GC
And observe that Go scans a few stack frames conservatively. I think it only does this if a stack frame is preempted. Most frames are scanned precisely.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.