Guile Mailing List Archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The taming of the before-gc-hook (was Re: Upcoming 1.3.2 release)

Jost Boekemeier <jostobfe@calvados.zrz.TU-Berlin.DE> writes:

> 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).


Look at scm_set_smob_free and scm_set_port_free.

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

It's a nice mechanism for specifying side-effects when objects are

From NEWS:

** New function: make-guardian
This is an implementation of guardians as described in
R. Kent Dybvig, Carl Bruggeman, and David Eby (1993) "Guardians in a
Generation-Based Garbage Collector" ACM SIGPLAN Conference on
Programming Language Design and Implementation, June 1993

Guile Home | Main Index | Thread Index