Weak references are on the horizon for JS:
http://wiki.ecmascript.org/doku.php?id=harmony:weak_maps#weakmap

> And related to that two questions:
>  1) Does anyone know how browsers avoid memory leaks with addEventListener ?

Not all listeners have to be weak references. If what you're listening
to is eligible for garbage collection, and you have no other
references to your listener, your listener is also eligible. I've seen
a fair amount of cargo-cult distrust for this (not saying your
particular question falls in this category), but this is precisely why
garbage collection works the way it does.

Reply via email to