capping memory usage of buildworld (c++)

Alfred Perlstein alfred at freebsd.org
Sun Mar 25 16:18:25 UTC 2012


I have a few vms with "only" 768MB to 1GB of ram.  The problem is
that buildworld is slow unless I give make(1) a jobs arg of about
8.  However now when it reaches the c++ part of the build, it starts
to page like crazy:

Mem: 495M Active, 47M Inact, 162M Wired, 20M Cache, 85M Buf, 1624K Free
Swap: 2048M Total, 1527M Used, 521M Free, 74% Inuse, 4272K In, 280K Out

  PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
44453 root          1  21    0   225M 71704K swread  1   2:14  2.98% cc1plus
44444 root          1  21    0   225M 68056K swread  1   2:18  1.95% cc1plus
44451 root          1  21    0   225M 72564K swread  0   2:17  1.95% cc1plus
44459 root          1  21    0   221M 66824K swread  1   2:13  1.95% cc1plus
44442 root          1  21    0   225M 67908K swread  1   2:12  1.95% cc1plus
44577 alfred        1  26    0 16716K  1812K CPU1    1   0:00  1.95% top
44446 root          1  21    0   225M 75148K swread  1   2:14  0.98% cc1plus
44440 root          1  21    0   225M 65184K swread  1   2:13  0.98% cc1plus
44435 root          1  21    0   225M 65084K swread  1   2:10  0.98% cc1plus

Is there any way to cap the jobs when forking off c++?

Would people be opposed to a hack where optionally one could fence
off the jobs for C++ programs during buildworld?  meaning maybe
set .NOTPARALLEL via some other option?

It's kind of insane how much memory the compiler uses these days.

Any other options?

-- 
- Alfred Perlstein
.- VMOA #5191, 03 vmax, 92 gs500, 85 ch250, 07 zx10
.- FreeBSD committer


More information about the freebsd-hackers mailing list