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: The taming of the before-gc-hook (was Re: Upcoming 1.3.2 release)


Mikael Djurfeldt <mdj@mdj-pc.nada.kth.se> writes:

> Jim Blandy <jimb@red-bean.com> writes:
> 
> > I don't think Guile should include any Scheme-level GC hooks.  That's
> > a meta-level crossing that I think is particularly nasty.
> > 
> > We should certainly provide both before- and after-gc hooks at the C
> > level.  These can be used safely and productively (as in SCWM's case),
> > and they give foolish users the opportunity to hang themselves
> > however they please.
> 
> Jim, we *need* at least one gc-hook on the Scheme level.
> (We currently have the %gc-thunk.)
> 
> Without it we loose the ability to get code executed when GC actually
> happens.  It would drain the power of guardians so that they become
> *less* powerful than finalization.
> 
> A typical thing is to put a guardian harvester procedure on the
> after-gc-hook.
> 
> What about alternative 1?
> It is simple, symmetrical and clean.
> 
> ?


Hi,

I haven't red the whole context so the following may lead into a
differend direction but a per object function that gets called when
the garbage collector attempts to collect an object would be nice.

Something like Java's finit function.  This hook may be a C level
hook and should only be used to invalidate c structures associated
with the object (file handles or in my case a pointer to a C function
that must be invalidated -- at the moment I track weak observers by keeping
indirect references into a weak observer array).


Btw:  What are guardians if I may ask stupid questions?


Jost
-- 

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