incubator-lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: Reference counting inside a GC host (was "real time updates")
Date Fri, 27 Mar 2009 12:21:54 GMT
On Fri, Mar 27, 2009 at 1:08 AM, Marvin Humphrey <> wrote:

> I think I have an approach that's going to allow us to eliminate FastObj: We
> lazily create the host object, and treat a NULL host_obj as semantically
> equivalent to a refcount of 1.

Much of this is beyond me, but... won't there be multiple references
in C to a given Lucy object, each of which would need to incRef the

Expanding on/restating my "sort of like autoboxing" idea...: what if
the Lucy obj never held onto the reference to the mirror host obj?
(And the Lucy obj did its own reference counting, separately from the
host's GC).

But, the reverse is allowed (the host can hold onto the Lucy mirror
obj that has incRef's (refers to) the Lucy obj).

When we cross the bridge, Lucy to host, we would make a new host
wrapper obj each time.  These host mirror objs are very lightweight
wrappers, right?  When that call returns across the bridge, Lucy drops
the reference to it.

The host is allowed to keep a reference somewhere to that host mirror
obj, and later cross the bridge in the reverse direction, using it.

Note that Lucy can still clearly store "other" host objects.  It's
just these 'thin host mirrors Lucy object" objects that would not be
retained in Lucy.

This then breaks the circular ref, and gives complete freedom for Lucy
to do whatever GC it needs, separate from the Host's GC.

But what do we lost by not retaining a permanent host obj wrapper?
(Note that if it's a real performance problem, then in certain cases
you could eg explicitly retain a reference at the top of the loop, do
the loop, then drop the reference at the end).


View raw message