[Gc] Switching the atomic property of an object

Florian Weimer fw at deneb.enyo.de
Tue Jul 17 13:31:33 PDT 2012


* Alex Rønne Petersen:

> In my virtual machine where I'm using libgc, every object has a header
> that contains a potential pointer into GC-allocated memory. This
> currently forces me to never allocate memory as atomic, even if I know
> that the object body itself will contain no GC pointers. The potential
> pointer in object headers is simply a user data field of sorts. For
> the vast majority of objects, it will never be set. This is a bit of
> an annoying situation, since I have to be conservative just because of
> that one potential pointer.

You could use a table index instead of a pointer, and free the table
entry with a finalizer.  Or you could store a pointer to an
uncollectable object which you free explicitly in a finalizer.



More information about the Gc mailing list