Skip to main content

soft_cap_from_ceiling

Function soft_cap_from_ceiling 

Source
pub fn soft_cap_from_ceiling(max_memory_mib: u64) -> u64
Expand description

Derive the cooperative soft-RSS budget (bytes) from the hard --max-memory ceiling (MiB). The soft fuse sits at 75% of the ceiling, leaving ~25% headroom for the post-processing phase (libxml DOM + XSLT) that runs above digestion and which this cooperative guard cannot see. 0 in → 0 out (disabled), so --max-memory=0 disables the whole memory limit. This keeps --max-memory the single knob: the hard Watchdog rides the ceiling, this fuse rides a fixed fraction below it — no independent second number.

The 75% factor reproduces the historical ~4.5 GB-under-6 GiB relationship at the 6144 MiB default (→ 4608 MiB) while scaling with any user-chosen ceiling (so a tight --max-memory also gets the graceful cooperative failure first, and a generous one raises both guards together).