Skip to main content

JS_STACK_SIZE

Constant JS_STACK_SIZE 

Source
pub const JS_STACK_SIZE: usize = _; // 268_435_456usize
Expand description

Stack reserved for the thread JS runs on (run_on_js_stack).

A JS call is a Rust recursion (host::run_user_func_nt → run_chunk_on → a fresh fusevm::VM on the stack), so recursion depth is bounded by the native stack rather than by a frame counter. On the OS default 8 MiB this bought only 83 frames in a debug build — measured, node -e 'function f(n){if(n<=0)return 0;return 1+f(n-1)} f(84)' aborted — where node v26.7.0 reaches 9901. Reserving 256 MiB is virtual address space, faulted in only as deep recursion actually uses it, and host::stack_exhausted still turns the far end into a catchable RangeError rather than an abort. The reservation is capped rather than sized to match node’s depth exactly so that a runaway recursion’s peak RSS stays bounded; the resulting depth is documented in BUGS.md.