Explict Memory Managment

Brendan Eich brendan at mozilla.com
Fri May 22 13:25:50 PDT 2009

On May 22, 2009, at 1:05 PM, David Semeria wrote:

> Swap out to disk - sorry I thought that was implicit

There's no disk on some devices. Anyway, that's up to the OS.

Advisory calls could help but we need some real examples, or better:  
evidence from real apps, before inventing advice APIs here.

>> Also obj.kill() would be almost [im]possible to actually implement  
>> since
>> what would happen if you happen to kill an object that still has
>> references somewhere?
> I would say the killed object would just equate to 'null'

Then set obj = null.

> If a programmer kills an object and then tries to reference it, then
> that's his/her problem

No. You're ignoring the possibility of other references:

obj = frobj = gobj = new Object; ...; obj.kill()

How what happens when frobj or gobj is used?

> I would assume the work involved in going through every DOM and script
> object and working out whether they are islands is non-trivial,  
> whereas
> de-allocating the actual memory for the resulting object list would  
> be.

See above -- you can't assume there are no other references to that  
memory. Each variable or property that can be assigned anywhere that  
could connect to obj (the object, not the reference) could save a ref.


More information about the es-discuss mailing list