pub struct Limits {
pub memory_bytes: usize,
pub stack_bytes: usize,
pub load_budget: Duration,
pub call_budget: Duration,
pub max_op_values: usize,
pub max_canvas_ops: usize,
pub max_nodes: usize,
}Expand description
Resource limits of one VM.
Fields§
§memory_bytes: usizeQuickJS heap, in bytes (0: no limit). Running out stops the VM.
stack_bytes: usizeInterpreter stack, in bytes: deep recursion becomes a RangeError
rather than a native stack overflow. Must stay below the engine
thread’s stack.
load_budget: DurationEvaluating the bundle.
call_budget: DurationAny other call into JS: one event (with the rendering it causes), one list bind, one timer, one frame’s callbacks, the microtask drain.
max_op_values: usizeChanges JS may make at once (the op queue’s length): they are held in Rust memory, which the heap limit does not cover.
max_canvas_ops: usizeOperations one canvas drawing may record.
max_nodes: usizeNodes the core keeps (each may have a native view, whose memory the heap limit does not cover either).
Implementations§
Source§impl Limits
impl Limits
Sourcepub fn standalone_desktop() -> Limits
pub fn standalone_desktop() -> Limits
The limits of an app nsh runs on its own on a desktop (the macOS, Windows and Linux hosts and runners): a 1 GB heap, as a desktop app may hold much more data than a module embedded in a host app.
Sourcepub fn standalone_mobile() -> Limits
pub fn standalone_mobile() -> Limits
The limits of an app nsh runs on its own on a phone or tablet (the iOS and Android hosts and runners): a 512 MB heap, well below where the systems end apps for their memory.
Trait Implementations§
impl Copy for Limits
Source§impl Default for Limits
The limits of an app embedded in a host app (NshAppView, NshView,
AppView): a 256 MB heap; the embedder may set others.
impl Default for Limits
The limits of an app embedded in a host app (NshAppView, NshView,
AppView): a 256 MB heap; the embedder may set others.