Re:A toddlers guide to memory leaks in JavaScript
by taneq on Monday February 05, 2018 @12:00AM
(#16306702)
In the context of a language with a working garbage collector, doesn't "memory leak" just mean "accidentally using lots of memory"?
[ Parent
| on HN ]
Re:A toddlers guide to memory leaks in JavaScript
by AstralStorm on Monday February 05, 2018 @03:36AM
(#16307462)
With cyclical references add "freed sometime between now and eternity".
If this is not a definition of a memory leak I don't know what is.
Re:A toddlers guide to memory leaks in JavaScript
by taneq on Monday February 05, 2018 @04:17AM
(#16307630)
Well no, cyclical references only stop the object from being deleted if it's still accessible. That's what the 'mark' part of 'mark and sweep' does - it marks all objects still accessible somehow from inside the program. Then the 'sweep' bit runs through all allocated blocks and frees the unmarked ones.
Now, if you're merely approximating garbage collection with reference counting then sure, you have a problem.