macOS memory guardrail

KlodyMem

In prod SwiftlaunchdmacOS

What it is

Swift daemon watching real memory pressure and suspending heavy consumers before suffocation. Two supervised agents: the guard and the menu bar.

The architect's call

Three beliefs measured then dropped. Swap ratio is noise: it sits at ~96% permanently because the pager resizes its own file — using it as a threshold fires continuously. Swap growth of roughly 1 GiB/s while loading a 35-billion-parameter model is normal, not an incident. And ps rss understates the MLX footprint by a factor of ~30: only phys_footprint tells the truth.

What went wrong

Three beliefs measured, then dropped. Swap ratio looked like the obvious signal: it sits around 96% permanently, because the pager resizes its own file. Using it as a threshold fires continuously. Swap growth of roughly 1 GiB/s while loading a 35-billion-parameter model is normal, not an incident. And ps rss understates the MLX footprint by a factor near 30 — only phys_footprint tells the truth. Any monitoring built on rss therefore reports all is well right up until the system dies.

A perfectly silent SIGKILL 137. Copying a signed Mach-O binary with cp invalidates its signature, and macOS kills it with no usable message. The sequence that works is rm, then cp, then codesign -f -s -. Several hours lost hunting an application bug that did not exist.

What stays deliberately disabled. Force-quitting applications at the critical threshold exists in the code but is not armed. A memory guardrail that closes the user's browser without warning will not survive a week.

The figures

~30×understatement of the MLX footprint by ps rss
~96 %permanent swap ratio — therefore useless as a threshold
2supervised agents in production
~1 Gio/sswap growth while loading a 35B: normal

The code

Try the demo ↗

Capabilities engaged

Related projects

Your data cannot leave the building?

That is precisely the problem I solve. A 30-minute call is enough to scope an audit.