Skip to main content

apply_memory_ceiling

Function apply_memory_ceiling 

Source
pub fn apply_memory_ceiling(max_memory_mib: u64)
Expand description

Apply the single --max-memory ceiling (MiB) to this thread’s cooperative soft fuse, so the one knob means the same thing on every conversion path.

--max-memory wins over LATEXML_RSS_CAP_BYTES, unconditionally. The flag is the single knob; an env var must not silently override what the user typed. This deliberately overwrites the env, which is why the env keeps its meaning exactly where no flag exists to contradict it: embedders that never parse CLI arguments and so never reach this function — the library test harness (util::test, which pins 9 GB) and the cortex_worker fleet (which pins each child to its --max-rss-mb). Both are unaffected.

Callers must be EVERY conversion path: the plain one, the --server forked body child, and the in-process fallback. When only the first called it, --server --max-memory=0 still ran against a live 4.5 GB fuse while the help text promised the limit was off.