Dev.to AI 🤖 Ai 👁 0 📖 3 min read

One node process grew from 10 GB to 268 GB in eleven minutes, and the guard I built let it

Yesterday at 2:37 PM my Mac showed "Your system has run out of application memory." I build a small menu bar app whose whole job is to stop that from happening, so this one stung. Here is what the logs showed. Between 2

Yesterday at 2:37 PM my Mac showed "Your system has run out of application memory." I build a small menu bar app whose whole job is to stop that from happening, so this one stung.

Here is what the logs showed. Between 2:25 and 2:36 PM, a single node helper running under Claude grew from about 10 GB to 268 GB of memory footprint. Swap reached 76 GB. My guard was checking every minute the whole time, and in those eleven minutes it stopped nine small leftover processes and never touched the one eating the memory.

That was by design, and the design was wrong. The rule I had written was simple: never kill anything that belongs to a live agent session. A guard that kills the wrong process throws away an hour of an agent's work, and that felt worse than a slow Mac. But a process holding 268 GB on a Mac with 48 GB of RAM is not work anyone wants to keep. It is a leak, and the Mac was going down either way.

So version 1.2.6 changed the rule. When memory is critical, a process whose footprint is at least half of RAM, and never less than 16 GB, gets stopped even if it lives inside an agent session. It gets SIGTERM first and SIGKILL three seconds later only if it is still the same process. It applies to runtimes like node, python, bun, deno, ruby and java. It still never stops apps, browser tabs, virtual machines, local model servers, databases, system processes or device management, and the notification names what it stopped and how much memory it held. The first version of the test missed app paths with spaces in them, like "Google Chrome.app", which is exactly the kind of thing you want a table test to catch before it ships.

Then the internet died

The same evening every web page started hanging. Ping to 1.1.1.1 was between 600 and 1,000 ms. The app correctly said why: my upload is only about 2.1 Mbps, and two background jobs were trying to push far more than that. One was a GitHub Actions self-hosted runner saving a build cache, and the other was Xcode's notarytool uploading an app to Apple. When the upload side of a home connection is full, everything else waits behind it, including the small requests a browser needs to load a page.

The app knew all of this and did nothing about it. It printed a nice sentence explaining the cause and left me to find the processes myself. Pausing those two uploads brought ping down to between 115 and 300 ms, and pages loaded again.

Version 1.2.7, released last night, does that pause on its own. When ping is 250 ms or worse and uploads are using at least 70% of the line, it pauses the bulk uploaders with SIGSTOP. It only pauses tools from a short list: notarytool, rsync, scp, rclone, gsutil, aws s3, gh release upload, docker push and CI runner steps. It never pauses browsers, video calls, VPNs, security software or the apps you are typing into, and it never kills the uploads it pauses. Once ping stays under 150 ms for two checks in a row, or after ten minutes at most, it resumes them with SIGCONT and they carry on where they stopped. There is also a "Pause uploads" button for when you want to do it by hand.

What I took from both

Both problems had the same shape. The tool saw the problem clearly and then deferred to a rule that was written for a different situation. "Never touch a live session" is right almost every time, and "just report it" is a safe default, but a guard that only reports is a dashboard. The fixes were not clever. They were narrow rules for the case the broad rule got wrong, with a hard limit on what they can touch.

Mac YOLO Safeguards is free for Apple Silicon Macs, and it is signed and notarized. The automatic actions above are part of Pro Guard, which is $29 once.

Website: https://macyolosafeguards.io/?from=devto
Release notes for 1.2.7: https://github.com/IgorGanapolsky/mac-yolo-safeguards/releases/tag/v1.2.7
Homebrew: brew install --cask igorganapolsky/tap/mac-yolo-safeguards

If your Mac has run out of memory while agents were running, I would like to hear what process did it. Every rule in this post came from a crash on my own Mac.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.