SetGCThreshold the runtime's GC threshold; use -1 to disable automatic GC.
(threshold int64)
| 695 | |
| 696 | // SetGCThreshold the runtime's GC threshold; use -1 to disable automatic GC. |
| 697 | func (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. |
| 713 | func (r *Runtime) GCThreshold() uint64 { |