pub const DEFAULT_R_STACK_SIZE: usize = _; // 8_388_608usizeExpand description
Default stack size for R-compatible threads (8 MiB).
R doesn’t enforce a specific stack size - it uses whatever the OS provides:
- Unix: Typically 8 MiB from
ulimit -s - Windows: 64 MiB for the main thread (since R 4.2)
Since we disable R’s stack checking via StackCheckGuard, the size is about
practical needs rather than R enforcement. Deep recursion in R code (especially
recursive functions, lapply chains, or complex formulas) can use significant stack.
Rust’s default thread stack is only 2 MiB, which may be insufficient for deep R calls.
We default to 8 MiB as a reasonable balance. Increase via RThreadBuilder::stack_size
if you encounter stack overflows.