I'm compiling source code in the terminal but 75% of the time the build will freeze my system and I have to hard reboot or wait for a LONG time until oom kills it. I'm positive it's a memory issue because I leave system monitor running on top and watch it throughout the compilation. Everything runs fine until ram/swap usage is maxed out and then freezes where it is and the CPU use drops back down to zero. I have 4gb of ram and have tried running builds with swapoff and also switching swap size to between 400 mb and 2 gb and the problem still persists. Iwas wondering if I can possibly pause the process until the ram is cleared instead of just killing it?
Somebody already did it here https://unix.stackexchange.com/questions/68611/whats-the-difference-between-ctrl-z-and-kill-stop
When I run a command (make on a large project) from the shell, I can type Ctrl-Z to stop the process and return to the shell. Subsequently, I can run fg to continue the process.
I am not sure though if the RAM will auto-clear.