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

Method SetMemoryLimit

runtime.go:681–694  ·  view source on GitHub ↗

SetMemoryLimit the runtime memory limit; if not set, it will be unlimit.

(limit uint64)

Source from the content-addressed store, hash-verified

679
680// SetMemoryLimit the runtime memory limit; if not set, it will be unlimit.
681func (r *Runtime) SetMemoryLimit(limit uint64) {
682 if r == nil {
683 return
684 }
685 if !r.ensureOwnerAccess() {
686 return
687 }
688 r.mu.RLock()
689 defer r.mu.RUnlock()
690 if r.closed.Load() || r.ref == nil {
691 return
692 }
693 C.JS_SetMemoryLimit(r.ref, C.size_t(limit))
694}
695
696// SetGCThreshold the runtime's GC threshold; use -1 to disable automatic GC.
697func (r *Runtime) SetGCThreshold(threshold int64) {

Calls 2

ensureOwnerAccessMethod · 0.95
LoadMethod · 0.80