4 ms·
Maybe a stupid question, but isn't the memory released anyway when I close the tab? So why do memory leaks matter?
by gray_-_wolf 3y ago
Maybe a stupid question, but isn't the memory released anyway when I close the tab? So why do memory leaks matter?
- dr_kiszonka 3y agoNot a web dev person, but some "tabs" have a very long lifetime, e.g., webmail clients, Whatsapp, etc.
- leptons 3y agoThe problem is if you don't close the tab, the memory leak can cause that one tab's memory to balloon to 1GB or more because memory isn't being released, when that tab should only be consuming 50MB.
- zdragnar 3y agoIt depends on how much you're leaking, and how fast. Best case scenario, it just slows down garage collection a little bit, as you're holding into a lot of references that aren't going anywhere. On the other hand, I recall a bug in a particular version of AngularJS where component DOM nodes wouldn't get cleaned up when navigating with the router unless you manually set all of the scope values their templates used to null. We had a data dense application with tables and what not, and you could clearly watch memory jump tens or more megabytes flipping between pages in the chrome dev tooling. Eventually (this was a SPA intended to be used for upwards of hours at a time) the page would crash.
- Xenoamorphous 3y agoHave you ever seen Chrome’s “aw, snap!” screen (if you use Chrome)? More often than not that’s due to a memory leak.
- chrisweekly 3y agoNot "stupid", but maybe hasty / shallow? Many SPAs are long-running, and memory leaks can accrue quickly, destroying performance.