Issue
Trying to prevent some.. stack overflow 🙄. I have memory leaks in my programs and they end up using 128GB of RAM.
Is there any program that would give me an alert after RAM exceeds an amount of my choice?
Or should I program it myself? Some cron job? If so, any suggestion on how to do it?
Solution
A cron
job plus some formatting of vm_stat
or sysctl
can do this - see here or here.
You could do the alert with some AppleScript too:
osascript -e 'display notification "This device's memory usage has exceeded 128GB!" with title "Memory Usage Warning!"'
However, I find solving the problem itself usually works best (e.g. fixing the memory leak :P)
Answered By - Dan P Answer Checked By - Candace Johnson (WPSolving Volunteer)