Weak references and destructors

David-Sarah Hopwood david-sarah at jacaranda.org
Thu Dec 10 17:09:16 PST 2009


Tom Van Cutsem wrote:
> Hi,
> 
> I think what you are looking for is this:
> http://wiki.ecmascript.org/doku.php?id=strawman:weak_references
> 
> On Thu, Dec 10, 2009 at 9:44 AM, Charles Jolley <charles at sproutit.com>wrote:
[...]
>> If we had a way to keep weak references for caches, the GC could reclaim a
>> lot more of our memory automatically.  If a destructor were called before an
>> object was dealloc'ed, we could clean up caches and tear down additional
>> references, possibly allowing further memory to be reclaimed as well.

The EphemeronTable abstraction described on the above page is ideal for
implementing caches. It doesn't require any extra work to explicitly remove
entries from the cache; they just go away when the key does.

-- 
David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 292 bytes
Desc: OpenPGP digital signature
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20091211/85709dec/attachment.bin>


More information about the es-discuss mailing list