Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a MacBook with Snow Leopard and 2 GB of RAM. When I compile C or C++ code, my system becomes all but unusable. For instance, when I compile LLVM I notice that there are about 10 or 11 processes (cc1plus) getting launched at a time that suck up my CPU time and memory. Is there any way to maybe make it compile less at one time? I'll gladly wait a while longer to have my system usable while I'm compiling.

Or is this something that you just have to live with when compiling C or C++?

share|improve this question
1  
If you are swapping, more RAM will help... and 2 GB is not a lot for a development box. –  dmckee Feb 17 '10 at 2:28
1  
2 GB should be plenty. I remember when 128 MB was a whole bunch. 2 GB is fine unless you're running a half dozen Adobe apps while trying to watch a full screen flash movie. –  Josh K Feb 17 '10 at 3:21
1  
@Josh K: I recall when 64 kB was a pretty good machine, but that doesn't change anything. Modern optimizing compilers use scads of memory to hold the internal representation of the code so that they can manipulate it every which way (some of that is waste, but by no means all of it). 2 gigs is not a lot of room for any good sized compilation. Not when you running a full service editor or ide with tens of open files, have a full service web browser up a dozen open tab, and the build launches multiple processes. –  dmckee Feb 17 '10 at 3:47
    
@dmckee - This isn't a development box. It's a personal computer. Occasionally though, I need to install some software from sources. –  Jason Baker Feb 17 '10 at 15:41
    
@Jasn: Than this is only an occasional issue, right? So use renice like profjim suggests when ever your feeling unduly bogged down. –  dmckee Feb 17 '10 at 18:38
add comment

2 Answers

up vote 2 down vote accepted

Use less parallel build jobs. Usually something between CPUs-1 and 2*CPUs-1 is completely sufficient.

Usually enabling parallel building (like with make -j) does not limit the parallelism at all but by the dependency resolver itself. In case of make add something like make -j3 to build with 3 build jobs in parallel.

Additionally you can deprioritize resource usage by writing nice make -j3 - in case you use make. What build system do you use by the way?

share|improve this answer
    
Usually it's just random makefiles or autoconf stuff. –  Jason Baker Apr 16 '10 at 14:08
add comment

Use nice or renice.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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