[Gc] Heap not emptying?

Andrew Haley aph at redhat.com
Sat Aug 12 02:34:38 PDT 2006


Mike Hearn writes:
 > On 8/12/06, Andrew Haley <aph at redhat.com> wrote:
 > > Compile with gc debugging turned on and you'll be able to ask where
 > > everything is being referenced from.  I suspect it'll be the stack,
 > > but try it and see.
 > 
 > OK, will do so, however unless it's picking up garbage from below
 > the current stack pointer, surely the GC should not see anything?
 > I'm testing this at a point just after main, where there is nothing
 > on the stack (except whatever the OS loader places there).

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.

But -- enough guessing already!  :-)

Andrew.


More information about the Gc mailing list