Re:A proposal to add signals to JavaScript
by gray_-_wolf on Sunday March 31, 2024 @03:17PM
(#39887174)
Maybe a stupid question, but isn't the memory released anyway when I close the tab? So why do memory leaks matter?
[ Parent
| on HN ]
Re:A proposal to add signals to JavaScript
by zdragnar on Sunday March 31, 2024 @03:45PM
(#39887408)
It 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.
Re:A proposal to add signals to JavaScript
by Xenoamorphous on Sunday March 31, 2024 @04:02PM
(#39887546)
Have you ever seen Chrome’s “aw, snap!” screen (if you use Chrome)?
More often than not that’s due to a memory leak.
Re:A proposal to add signals to JavaScript
by dr_kiszonka on Sunday March 31, 2024 @03:39PM
(#39887349)
Not a web dev person, but some "tabs" have a very long lifetime, e.g., webmail clients, Whatsapp, etc.
The 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.
Re:A proposal to add signals to JavaScript
by chrisweekly on Sunday March 31, 2024 @11:36PM
(#39890704)
Not "stupid", but maybe hasty / shallow? Many SPAs are long-running, and memory leaks can accrue quickly, destroying performance.