Reducing compilation memory usage

Alejandro Pulver alepulver@FreeBSD.org
Fri Jan 18 10:56:00 GMT 2008


On Thu, 17 Jan 2008 08:24:46 -0800
"John (Eljay) Love-Jensen" <eljay@adobe.com> wrote:

> 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".
> 

Yes.

> > 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?
> 

Tried -O1 with all -fno-*, and runs out of memory.

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

This explains the previous behavior, thanks.

> > 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.
> 

Ah, so it's normal (never tried this, so I didn't know, sorry).

> > Do you want the preprocessed source, and the exact -f* options?
> 
> No.
> 
> > I was initially looking for using -O2 with necessary -f-no-* to avoid running out of memory.
> 
> That is the approach I recommend.
> 

As it fails with -O1 and all -fno-*, I tried parameters like
max-pending-list-length=1 without success.

Do you know about an option or something that could help in this case?

I've read something about compilers and this high memory usage could be
caused by keeping references to variables of other blocks (compilation
units, IIRC). So if there is a way to disable that optimizations (tried
-fno-unit-at-a-time and max-pending-list-length=1), and to make it the
most "linear" as possible, it would help (if there are such additional
things I missed).

Or should I ask this more specific question in another place?

Thanks and Best Regards,
Ale
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20080118/28a7f1d4/attachment.sig>


More information about the Gcc-help mailing list