[cairo] reference counting vs garbage collection

Carl Worth cworth at cworth.org
Wed Jan 5 12:07:19 PST 2005


On Wed, 05 Jan 2005 11:03:17 -0800, Keith Packard wrote:
> Around 13 o'clock on Jan 5, Carl Worth wrote:
> > 
> > _create		Allocate object. refcnt = 1. Connect dependent objects
> > _reference	refcnt++
> > _finish		Finalize dependent objects
> > _destroy	if (--refcnt = 0) { _finish; Free object }
> 
> (I believe the term 'close' was used instead of 'finish' in the last 
> message proposing this design).

Yes, and I intentionally avoided it. To me "close" suggests a call
symmetric with "open". But we don't have any cairo_surface_open.

How about _finalize ?

> This will work just fine for me, but loses some of the symmetry in the
> create/destroy ref/unref model.

Following Bill's suggestion, we could have have aliased names
_unreference and _destroy to maintain the symmetry.

-Carl



More information about the cairo mailing list