// goal = marked * (1 + GOGC/100)
// = trigger / (1 + triggerRatio) * (1 + GOGC/100)
memstats.next_gc = uint64(float64(memstats.gc_trigger) / (1 + gcController.triggerRatio) * (1 + float64(gcpercent)/100))
+ if gcpercent < 0 {
+ memstats.next_gc = ^uint64(0)
+ }
work.startSema = 1
work.markDoneSema = 1
}
// Re-compute the heap goal for this cycle in case something
// changed. This is the same calculation we use elsewhere.
memstats.next_gc = memstats.heap_marked + memstats.heap_marked*uint64(gcpercent)/100
+ if gcpercent < 0 {
+ memstats.next_gc = ^uint64(0)
+ }
// Ensure that the heap goal is at least a little larger than
// the current live heap size. This may not be the case if GC
// The next GC cycle should finish before the allocated heap
// has grown by GOGC/100.
memstats.next_gc = memstats.heap_marked + memstats.heap_marked*uint64(gcpercent)/100
+ if gcpercent < 0 {
+ memstats.next_gc = ^uint64(0)
+ }
if memstats.next_gc < memstats.gc_trigger {
memstats.next_gc = memstats.gc_trigger
}
// Statistics about garbage collector.
// Protected by mheap or stopping the world during GC.
- next_gc uint64 // goal heap_live for when next GC ends
+ next_gc uint64 // goal heap_live for when next GC ends; ^0 if disabled
last_gc uint64 // last gc (in absolute time)
pause_total_ns uint64
pause_ns [256]uint64 // circular buffer of recent gc pause lengths
}
func traceNextGC() {
- traceEvent(traceEvNextGC, -1, memstats.next_gc)
+ if memstats.next_gc == ^uint64(0) {
+ // Heap-based triggering is disabled.
+ traceEvent(traceEvNextGC, -1, 0)
+ } else {
+ traceEvent(traceEvNextGC, -1, memstats.next_gc)
+ }
}