1

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?

  • 1
    what are you trying to compile? This is a strange situation --- are you sure you are not using a full parallelized make (like make -j?) - in that case just limit the number of parallel tasks (hardly anything over make -j4 helps, unless you have a monster machine). – Rmano Dec 2 '14 at 8:22
  • I haven't built Android, but I'm assuming you're doing so from the root directory, is that correct? Is there a way that you can break the process into more manageable chunks? What I'm thinking is that maybe make itself is keeping resident memory for what I would imaging would be a lot of sub-jobs -- memory that it would keep resident until the relevant piece or group of pieces is finished with their sub-make. However, if you could break it down into smaller jobs, perhaps you could avoid the oom issue. – Chuck R Dec 2 '14 at 11:51
  • @Githlar not running from the root but a sub directory ~/android/build. I split off about 25% by building the kernel separately but thats about all I can do in split jobs AFAIK. Periodically I tried turn swap on and off during the build to free up space for then end. It is near the end of the build process just before everything starts to be packaged into the final compilation that it hangs (yes the most memory/process intensive task). – Isaac Wilson Dec 2 '14 at 11:58
0

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.

  • The RAM does not clear until the process is finished, so suspending doesn't release RAM. However, it might help swap since it can take substantially longer to clear than RAM. – Chuck R Dec 2 '14 at 8:46
  • @rmano thanks but i am not using an unlimited -j, I was only using -j2, -j3, or -j4. And I'm compiling android – Isaac Wilson Dec 2 '14 at 11:43
  • @Githlar the process isn't running anymore though, once the memory hits 100% the whole system freezes and is unresponsive until it gets killed or i hard reboot. – Isaac Wilson Dec 2 '14 at 11:45
  • I understood what you meant by oom. I was just saying that his answer doesn't really fix the problem necessarily. However, since swap is also an issue for you, suspending occasionally may give the kernel time to dump swap. Time that it might not have otherwise because of the quick pace of the make process, thus perhaps preventing the oom to some degree. – Chuck R Dec 2 '14 at 11:47
  • @f01 Will ctrl-z and fq allow it to finish up the most recent process thus freeing up some ram? I'm upgrading to 8 gb of ram soon so that should hopefully help a lot – Isaac Wilson Dec 2 '14 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.