[Gc] Re: Heap not emptying?

Mike Hearn mike at plan99.net
Mon Aug 14 13:53:43 PDT 2006


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 :(

I'm not too worried, but it'd be nice to have some way to temporarily
disable this GCC behavior so if I do { int foo = 0xdeadbeef; while (true);
} then ESP actually points to foo or just below it.

thanks -mike



More information about the Gc mailing list