[H-GEN] Reducing kernel memory footprint?

Martin Pool martinp at mincom.com
Sun Dec 5 19:38:23 EST 1999


[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics.  Please observe the list's charter.          ]

Chris Baird wrote:

> Now, gcc's RSS is more than core, and the system, as expected always
> thrashes.  (The much vaunted lcc has even worse memory usage, I've
> found!)  Every byte counts (tweaking out 4% more memory improved
> compile times by 30%), so I'm asking people here for tips on reducing
> the kernel and friends' footprint.

It may be possible to configure gcc to run its various stages (cpp, cc1,
cc2, as, ld) in sequence: I think by default it tries to run them at the
same time with pipes connecting them.  That is, you want to first write
the preprocessed source to disk, then compile it to the intermediate
form, and so on.  I'm only speculating here, but perhaps there is room
for improvement.

In normal circumstances of course writing the files to disk will be
slower than just passing the data between processes, but when even one
stage won't fit in memory it might help.

Another interesting thing would be to call the stages directly, rather
than through the gcc driver: run gcc -V (or should that be -v?) and put
that into your script.  Of course you should be running from a shell
script or direct from emacs, not from Make.

Also, when compiling the kernel and large binaries you should look at
the -f alignment options, which let you get a crude space-speed tradeoff
on platforms like x86 that can do unaligned access.  I remember davidj
got a significant improvement on meesha by making his kernel more
luxuriously aligned.  Perhaps by setting them all to single-byte you can
squish your kernel and emacs.  (Not that you exactly have a lot of
cycles to throw away, but 386s won't care about it too much.)

-- 
Martin

The Internet is not a network of computers. It is a network
of people. That is its real strength.
			-- Rik van Riel

--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.



More information about the General mailing list