[m-dev.] New conservative GC
Ralph Becket
rafe at csse.unimelb.edu.au
Mon Apr 16 14:26:26 AEST 2007
Jonathan Morgan, Monday, 16 April 2007:
>
> Quite a few of the libraries in extras (e.g. curses and Tk bindings)
> redefine malloc and friends in terms of GC_malloc and friends.
>
> If malloc is re-defined in terms of HGC's malloc, then most uses of
> malloc in these libraries will be allocating (potentially) mutable
> data structures. I imagine that this would remove quite a few of
> HGC's advantages. On the other hand, if it is not done, then HGC may
> not be aware of memory references, causing it to incorrectly collect
> data.
You're quite correct: some care is necessary.
> >From the Reference Manual (14.8 Memory Management):
> Future Mercury implementations may use non-conservative methods of
> garbage collection. For such implementations, it will be necessary to
> explicitly register pointers passed to C with the garbage collector.
> The mechanism for doing this has not yet been decided on. It would be
> desirable to provide a single memory management interface for use when
> interfacing with other languages that can work for all methods of
> memory management, but more implementation experience is needed before
> we can formulate such an interface.
>
> I suggest that this might be the right time to work out a memory
> management interface. It sounds to me that the registering of
> pointers that have been passed to C is likely to be the best way of
> interfacing a Mercury hgc grade with an existing C library like Tk
> that holds references to Mercury data structures (typically closures
> for callback registration).
It's a noble goal, but given the signal lack of progress the C-- team
have made on this issue, and it's one of their core concerns, I wouldn't
hold your breath!
-- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions: mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the developers
mailing list