From: Preben Randhol <randhol+abuse@pvv.org>
Subject: Why is memory footprint smaller when compiled static?
Date: Tue, 4 Jun 2002 15:14:22 +0000 (UTC)
Date: 2002-06-04T15:14:22+00:00 [thread overview]
Message-ID: <slrnafpmag.47h.randhol+abuse@kiuk0156.chembio.ntnu.no> (raw)
I compiled my application (a GtkAda program) on Linux first as:
gnatmake glosa -O3 `gtkada-config -static` -bargs -static
then as
gnatmake glosa -O3 `gtkada-config`
I stripped both executables afterwards (as I forgot the -s flag)
The executable sizes becomes:
2583572 bytes for the static version
752060 bytes for the dynamic version
When I run the two programs and examine the memory usage of the two
programs I find :
3296 kb for the static version
4412 kb for the dynamic version
Why is there such a big difference? Is it because the compiler can do
better job at optimising the code when you build it statically.
I also did the same without the -O3 switch and then the memory usage
was:
3412 kb for the static version
4512 kb for the dynamic version
Preben who knows very little on how compilers work
next reply other threads:[~2002-06-04 15:14 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-04 15:14 Preben Randhol [this message]
2002-06-04 16:13 ` Why is memory footprint smaller when compiled static? Mark Johnson
2002-06-04 21:01 ` Florian Weimer
2002-06-04 21:02 ` Florian Weimer
2002-06-04 21:03 ` Florian Weimer
2002-06-05 11:10 ` Preben Randhol
-- strict thread matches above, loose matches on Subject: below --
2002-06-05 11:37 Grein, Christoph
2002-06-05 12:36 ` Preben Randhol
2002-06-05 13:42 ` Mark Johnson
2002-06-06 0:02 ` Steven Deller
2002-06-06 10:35 ` Preben Randhol
2002-06-06 14:26 ` Gautier
2002-06-06 15:08 ` Jean-Marc Bourguet
2002-06-06 15:24 ` Jean-Pierre Rosen
2002-06-06 19:35 ` Jeffrey Carter
2002-06-10 23:51 ` Randy Brukardt
2002-06-11 0:53 ` Robert A Duff
2002-06-11 16:45 ` Wes Groleau
2002-06-11 17:08 ` Preben Randhol
2002-06-11 19:12 ` Wes Groleau
2002-06-11 21:38 ` Randy Brukardt
2002-06-11 21:32 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox