This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: conservative scanning and infinite streams
Ole Myren Rohne <ole.rohne@cern.ch> writes:
> > I remember Hans Boehm talking about all the tricks his GC does to
> > clear the stack whenever possible.
>
> I found a pointer to that on this list. I tried to add a call to
>
> static void scm_gc_clear_stack ()
> {
> SCM dummy[2048];
> bzero (dummy, sizeof (SCM) * 2048);
> }
>
> at the start of each gc - more or less what Boehm does. It didn't
> help...
but of course. when you enter GC, the stack *below* is already full
of junk, so clearing stack at that time is too late.
what Boehm does is this (pseudo code):
void *clear_stack(void *arg)
{
word dummy[2048];
bzero (dummy, sizeof (word) * 2048);
return arg;
}
void *malloc(size_t size)
{
return clear_stack (real_malloc(size));
}
that is, do it after each malloc, because the user expects malloc to
take time anyway.
yes, it's gross, but so far nobody has come up with a better idea.
[ note that you might need to do some funny things in order to prevent
the compiler from optimizing away the bzero ]
--
:FATAL ERROR -- ILLEGAL ERROR-