3 ms·
> If you are writing an application in Javascript, soon you will have to worry about memory leaks. What? No! Memory leaks are impossible in fully garbage colle
by gwbas1c 6y ago
> If you are writing an application in Javascript, soon you will have to worry about memory leaks.
What? No! Memory leaks are impossible in fully garbage collected environments. A memory leak is when you manually allocate memory and loose the pointer, thus making it impossible to access the memory. (Because there's no pointers in Javascript, there's no memory to leak.)
What's happened is not a memory leak, it was an unregistered event handler. These are best diagnosed with profilers, not gymnastics with weak references. (It's not a memory leak because there is still a valid reference through the event handler, ie, no lost pointer.)
- jonathanlydall 6y agoEven if there is a more correct technical term for this, I think you’re trying to fight back an ocean here. If you have a function which each time inadvertently creates a new object in memory which it never de-references (thus is never GC’d), repeated use of the function will ultimately result in memory exhaustion and termination of the process. Everyone I’ve ever met would refer to that as a memory leak.