Reducing compilation memory usage

John (Eljay) Love-Jensen
Fri Jan 18 08:22:00 GMT 2008

Hi Alejandro,

> I didn't use them simultaneously. There are 3 scenarios:
> 1. No options: builds.

That is the same as -O0 "do not optimize".

> 2. -O1/-O2/-O3: runs out of memory.

Did you try -O1 (or -O2 or -O3) and -fno-* disable all the optimizations that can be disabled?

Note that most optimizations enabled by -O1 (and greater) do not have -f* toggles.

> 3. -f* (corresponding to when enabling -O2 as manpage says, but NOT -O2): builds, but the final program runs at the same speed.

That is the same as -O0 "do not optimize".

The -f* are ignored.

> Do you want the preprocessed source, and the exact -f* options?


> I was initially looking for using -O2 with necessary -f-no-* to avoid running out of memory.

That is the approach I recommend.


More information about the Gcc-help mailing list