Weak references and destructors

Brendan Eich brendan at mozilla.com
Thu Dec 10 11:10:49 PST 2009


On Dec 10, 2009, at 10:11 AM, Charles Jolley wrote:

> That looks pretty much right on.  Thanks Tom!  Can anyone give any  
> insight as to how likely it is this might actually happen?

You want me to lay odds? ;-)

It might help to read these wiki pages, in this order:

http://wiki.ecmascript.org/doku.php?id=harmony:harmony
http://wiki.ecmascript.org/doku.php?id=harmony:proposals
http://wiki.ecmascript.org/doku.php?id=strawman:strawman

According to Goals 1(II) "libraries (possibly including the DOM)  
shared by those applications" and 1(III) "code generators targeting  
the new edition", weak references are pretty important.

I think we'll get some kind of weak reference / ephemeron support in  
for the next edition, but we need to hash out details of what's  
normative and what's implementation-dependent, and finalize things to  
the point where implementors can take the chance to invest in  
prototyping.

/be

>
> -C
>
> On Dec 10, 2009, at 10:03 AM, Tom Van Cutsem wrote:
>
>> Hi,
>>
>> I think what you are looking for is this:
>> http://wiki.ecmascript.org/doku.php?id=strawman:weak_references
>>
>> Cheers,
>> Tom
>>
>> On Thu, Dec 10, 2009 at 9:44 AM, Charles Jolley  
>> <charles at sproutit.com> wrote:
>> Hi,
>>
>> I was wondering if any thought has gone into adding weak references  
>> and destructors to Harmony.
>>
>> We are finding that as we build large, long running JS apps, it is  
>> very hard to keep memory under control using the built-in GC since  
>> any reference - even for caching - will prevent the memory from  
>> being reclaimed.
>>
>> 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.
>>
>> Of course I can implement something like explicit reference  
>> counting in existing ES engines to get around this but then we lose  
>> many of the benefits of automated GC.
>>
>> -Charles
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20091210/86aea053/attachment.html>


More information about the es-discuss mailing list