This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Marking smobs for GC


Michael Livshin <mike@olan.com> writes:

> Greg Harvey <Greg.Harvey@thezone.net> writes:
> 
> > Marius Vollmer <mvo@zagadka.ping.de> writes:
> > 
> > > Greg Harvey <Greg.Harvey@thezone.net> writes:
> > > 
> > > > Maybe this would be a bit easier with guardians?
> > > 
> > > You mean, I could just let the proxy/widget move into a guardian when
> > > there are no references to it from Scheme and then, after the GC, do
> > > the internal reference boogie to find out which of them are really
> > > dead and resurrect the rest?  Yes, that could work.  It would be
> > > basically the same as what I'm doing now, but probably more efficient.
> > 
> > Actually, you could just slap it into a guardian from the beginning,
> > and look at the dead ones after collection. If they aren't really
> > dead, put them back into the guardian.
> 
> That's what I thought too.  Should be safe as long as the garbage
> collector is not timer-activated ;).

Actually, I think that you'd have to protect objects created in a
timer differently from the other objects anyway (I'm not quite sure
how that works... all I know is that gtk can make windows ;).

> BTW, it would really be helpful to have a post-GC hook or somesuch
> in Guile, so that people could attach things to it.

I think that's what %gc-thunk is for (I've been meaning to grok
async.c, but I keep finding more interesting things to do ;). I've
been meaning to add a before & after-gc-hook to the gc, though
(should only take a few minutes).
 
-- 
Greg