"powerLaw" calibration may usethresholdForks.Rdmcmapply() forks this process. Each child starts as a copy-on-write image
of the parent and diverges as R's garbage collector marks the heap, so the
honest per-child budget is the parent's own R heap, not a fixed 5000 MB: on
2026-09-07 the forks of a ~90 GB parent each reached ~37 GB of private
memory within minutes. There is no floor above one. The previous
max(4L, ...) forced four such children per simulation whatever the host
had left and whatever options(mc.cores) said; three simulations doing that
on one host exhausted 1 TB.
thresholdForks(
heapMB,
availMB,
nPars,
detCores,
activeThreads = 0L,
mcCores = NULL,
loadCap = Inf
)numeric; R heap in use in this process, MB (sum(gc()[, 2])).
numeric or NULL; memory available on the host, MB.
Unknown (NULL, empty, non-finite) means one fork.
integer; number of parameter sets to evaluate.
integer; the cores this process may use (parallelly::availableCores(): a Slurm job's CPUs, a cgroup's quota).
integer; busy threads already running on the host.
integer or NULL; getOption("mc.cores"), an explicit cap.
numeric; cap from the host's load (fireSenseUtils::nThreads()). Inf (default) is no cap.
integer, at least 1.
Threads already busy on the host reduce the CPU budget only. The previous code subtracted them from the minimum of every budget, which on a shared host went negative and landed back on the floor.