Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/runtime/gc_finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ type finalizerEntry struct {
fn interface{}
}

// finalizerGCThreshold starts pressure GC when registrations indicate external memory pressure.
// Larger tables use a proportional threshold. Zero disables this trigger.
const finalizerGCThreshold = 32

var (
finalizers *finalizerEntry // registered finalizers; a GC root that keeps fn values alive
finalizerPending *finalizerEntry // finalizers whose object died, waiting to run
Expand Down
10 changes: 10 additions & 0 deletions src/runtime/gc_finalizer_nopressure.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build (gc.conservative || gc.precise) && runtime_nofinalizerpressure

package runtime

// finalizerGCThreshold is zero with the build tag runtime_nofinalizerpressure:
// finalizer registrations do not start a collection, and finalizers run after
// the collections the heap itself needs. For programs that register many
// finalizers and go idle often, such as syscall/js programs, where every
// js.Value registers one and every await is an idle.
const finalizerGCThreshold = 0
7 changes: 7 additions & 0 deletions src/runtime/gc_finalizer_pressure.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build (gc.conservative || gc.precise) && !runtime_nofinalizerpressure

package runtime

// finalizerGCThreshold starts pressure GC when registrations indicate external memory pressure.
// Larger tables use a proportional threshold. Zero disables this trigger.
const finalizerGCThreshold = 32