This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Stack usage of g77-generated code: Worth a compiler option ?
- To: Craig Burley <burley at gnu dot org>
- Subject: Stack usage of g77-generated code: Worth a compiler option ?
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Wed, 2 Dec 98 00:26:23 +0100
- Cc: egcs at cygnus dot com
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
Craig and others on the egcs list,
Now that I am fully operational on my laptop (except for a modem
connection and hence CVS'd snapshots), I decided to try to run our
standard weather forecasting test suite.
Due to the fact that Modern Linux is ELF based (as opposed to my -
loosely speaking - COFF based NEXTSTEP system) I didn't have to
force all arrays (independent of size) to the stack. [ For those
who do not know this: NEXTSTEP's object format tends to fill all
statically allocated arrays with zeros, which leads to huge object
files and ditto .a libraries ]
However, my original (around '94) complaint about g77's default
still has merit: I compared the memory requirement of a run
compiled with the standard "arrays of size above 32Kbytes are
statically allocated" vs. "all arrays are allocated on the stack".
The first option led to an executable with 51 Mbyte of RSS, the
second to one of 43 Mbyte. This seems a significant difference to
me.
The reason for this difference is that stack space gets reused,
while statically allocated local arrays are there forever ;-)
Would it be possible to make the stack/nostack cutoff a compile
time option ? That sure beats rebuilding the compiler ...
Thanks in advance,
Toon.