[gtk-list] Re: Reference counting




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...).


Patrice.



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