[Gc] Re: Heap not emptying?

Andrew Haley aph at redhat.com
Mon Aug 21 01:44:18 PDT 2006


Mike Hearn writes:
 > On Sat, 12 Aug 2006 10:34:38 +0100, Andrew Haley wrote:
 > > Well, we'll see.  I have no idea what processor architecture you're
 > > using, but that processor has registers, and the compiler puts
 > > pointers into them.  You, as a C{++} programmer, don't have any way to
 > > clear those registers.  It only takes one pointer in one register to
 > > hold on to a lot of garbage.
 > 
 > Well, your original guess was correct, it was finding the pointer in a
 > dead part of the stack. The 'problem' (of course it's only a problem in my
 > faux test) is that GCC reserves a ton of stack space in main() for some
 > mysterious reason, and so %esp consistently points to about 20 words below
 > the actual bottom of the stack as it appears in the program. So the
 > collector sees tons of dead pointers and that roots pretty much the entire
 > program :(

It's probably for stack alignment.  Some architectures perform better
with aligned stack pointers, and some architectures actually require
it.

Andrew.



More information about the Gc mailing list