Re: [gtk-list] Re: Reference counting



On Wed, 26 Nov 1997, Patrice Fortier wrote:

> 
> G. Sumner Hayes wrote:
> > On Mon, Nov 24, 1997 at 07:38:14PM +0100, Marius Vollmer wrote:
> 
> [snip]
> 
> >> Another conclusion we might draw: It doesn't make sense to provide
> >> *both* reference counting *and* explicit freeing routines.
> 
> > Not true.  Many GC'd systems provide a free() function which tells the
> > collector to free that object immediately.  It is only used with large
> > objects that may have outstanding references but the programmer knows they
> > won't be used.  Using free() is considered somewhat dangerous but can
> > be a big performance win under the right conditions.  Having an explicit
> > free() also allows circular references to be busted apart and GC'd.
> 
> In this case we have to say *clearly* when the free() function should be
> used. ref counting + explicit free() is *highly* disturbing for anybody
> who doesn't want to look at memory managment. I think most peolpe will
> use free() instead of unref() because of their lack of knowledge on this
> subject (it's C programming after all...).

Nonsense, IMO. Each GUI kit (and all libraries, for that matter) have
their own "contracts" with the programmer, and there aren't many libraries
where you can free() objects willy-nilly and expect everything to work
perfectly. Reference counting is a reliable, portable technique that many
libraries use (and virtually all interpreters use), that if _well
integrated_ with the Gtk library, should be mostly transparent.

-- 
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)




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