I haven't really found a solid answer to this question other than "get more ram". Is there a way to reduce the memory used by g++ during the compile process? I am (for reasons) trying to compile webkitgtk on a g4 mac mini with 1GB ram. It can't be upgraded. Current compilation options are
-Os -mabi=altivec -mcpu=native -mtune=native
.
It has 1GB ram and 1GB swap but just runs out of memory. While I could theoretically just keep adding swap space, in practice this gets very slow, and I want to minimize that.
Webkitgtk is notoriously demanding of RAM (and time) during compilation. The Webgtk build instructions link to some suggestions, which might be useful. But the overall impression those pages give is that you need considerably more than 1GB of RAM, unless you are prepared to let the build run for some time, possibly days.
Perhaps you have access to one or more other computers. In that case, you could consider setting up cross-compilation environments and maybe even installing distcc in order to make use of these additional resources.
Setting up a cross-compilation environment for an OS X target is a bit of a project, but once you've got that set up distcc is pretty straightforward. And it won't take very many compiles to pay back your investment in time through significantly reduced compile times.