MCPcopy Create free account
hub / github.com/buke/quickjs-go / SetGCThreshold

Method SetGCThreshold

runtime.go:697–710  ·  view source on GitHub ↗

SetGCThreshold the runtime's GC threshold; use -1 to disable automatic GC.

(threshold int64)

Source from the content-addressed store, hash-verified

695
696// SetGCThreshold the runtime's GC threshold; use -1 to disable automatic GC.
697func (r *Runtime) SetGCThreshold(threshold int64) {
698 if r == nil {
699 return
700 }
701 if !r.ensureOwnerAccess() {
702 return
703 }
704 r.mu.RLock()
705 defer r.mu.RUnlock()
706 if r.closed.Load() || r.ref == nil {
707 return
708 }
709 C.JS_SetGCThreshold(r.ref, C.size_t(threshold))
710}
711
712// GCThreshold returns the runtime GC threshold.
713func (r *Runtime) GCThreshold() uint64 {

Calls 2

ensureOwnerAccessMethod · 0.95
LoadMethod · 0.80