4 ms·
There is no need for the concept of ownership of memory in JavaScript. So you are wasting time on a concept that doesn't matter in languages with a real GC. Dea
by auggierose 1y ago
There is no need for the concept of ownership of memory in JavaScript. So you are wasting time on a concept that doesn't matter in languages with a real GC. Dealing with ownership = manual memory management.
- zdragnar 1y agoThis used to not be true- once upon a time, Internet Explorer kept memory separate for DOM nodes and JavaScript objects, so it was very easy to leak memory by keeping reference cycles between the two. Now, with all the desire for WASM to have DOM access I wonder if we'll end up finding ourselves back in that position again.
- zarzavat 1y agoYou can still have ownership issues and leaks even with a GC, if an object is reachable from a root. e.g. object A is in a cache and it references object B which references objects C D E F G ... which will now never get collected. If A owns B then that is as expected but if A merely references B then it should hold a WeakRef