Explict Memory Managment

David Semeria david at lmframework.com
Fri May 22 13:53:43 PDT 2009

On Fri, 2009-05-22 at 13:37 -0700, Brendan Eich wrote:
> On May 22, 2009, at 1:27 PM, David Semeria wrote:
> > On Fri, 2009-05-22 at 11:46 -0700, Brendan Eich wrote:
> >
> >> As Ash points out, there's no memory-safe way to implement obj.kill()
> >> short of a full GC.
> >>
> >> There is no way JS will lose memory safety, ever!
> >>
> > Why can't the deleted object still exist, with its value set to  
> > 'null'?
> First, null is not a "value" in the sense of object value. An object  
> takes up arbitrary space associating property names with values.  
> You're possibly confusing reference and referent again.

That's very likely - I have only a very rudimentary idea of how the
language is implemented in the browser.

> Yes, GC uses more memory on average than if you gave explicit advice  
> that was reliable. But the advice can't be trusted without walking the  
> object graph.

Ok. I assume object references are implemnted bi-directionally,
otherwise the GC would take a lifetime to run. If that's the case
couldn't obj.kill() check whether the object was killable, and throw if
it isn't. That would be a massive debugging aid.

> > I intentionally didn't go into specifics, but I can provide some real
> > world examples if you think they would be helpful.
> Sure.

I'll do that then. It'll take a while to prepare.

More information about the es-discuss mailing list