Guile Mailing List Archive

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

Re: gh_enter reconsidered



> The Boehm collector, as I understand it, does conservative GC for
> actual C and C++ objects by scanning the stack and the heap
> conservatively for pointers. It must not free objects your code has
> dropped references to if they might be referenced by whatever is on
> the heap before main() (which is quite possible if you mutate argv or
> envp).

You mean that you actually write code that not only modifies pointers
in argv[] but makes them point to dynamically allocated memory objects
that you want the garbage collector to handle? Am I the only one who
thinks this is insane or is there a trick that I'm missing?

I can hold with modifying argv[] pointers to reorder the existing
pointer values or drop some out but that is about the limit of my courage.

What sort of behaviour is guile supposed to cater for?

How about sticking a SCM object into the argv[] array? Wouldn't
that be cool...

More seriously, C++ can have constructors that get executed before
main() and these might use local variables which need garbage collection.
Currently guile can't handle this situation at all because such
devices are outside the of gh_enter() but I figure that getting C to work
is the first step (my previous message was with C in mind).

(Note that if gh_enter() returned void then C++ constructors in such
situations could actually use guile to calculate their initial values.
I suspect that the applications for this are many and varied but all
of minimal value).

	- Tel


Guile Home | Main Index | Thread Index