memory safety and weak references
brendan at mozilla.com
Mon Apr 1 14:56:06 PDT 2013
Hudson, Rick wrote:
> This brings up another interesting point. Do WeakRefs change a
> compiler’s liveness analysis?
Yes, of course.
> This could complicate some apparently useful optimizations.
> var x = new Something();
> // Is x dead? (yes) Is x required to contribute to the root set? (I
> hope not.)
You dind't kill x yet. Did you forget
x = null;
> someWeakRef.get() // null or foo?
If x = null; happened before gc() then null else the original ref.
More information about the es-discuss