TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Managing Memory in Javascript is Hard

33 pointsby superfreekabout 12 years ago

6 comments

davidwabout 12 years ago
And to confuse things further, we'll provide examples in Coffeescript?<p>To be fair, they do link to some JS conversion thing, but I'd prefer to read the examples right in the article - "don't make me think" and all that.
评论 #5705551 未加载
评论 #5705763 未加载
georgemcbayabout 12 years ago
I still have nightmares about memory management in JavaScript following an unfortunate project involving a very media-rich application running on Vizio TVs with "Yahoo Widgets for Connected TVs" (a non-HTML JavaScript app framework that derives from the old Konfabulator).<p>Not only do you have all the usual issues with JavaScript and memory, but the amount of RAM available is tiny and the garbage collector is run on a set timer and if you blow your memory budget between these timed calls to the garbage collector, the program soft crashes (you'd think an emergency gc would be scheduled if memory pressure were that high -- you'd be wrong!). Even if you were very careful to set unused objects to undefined or explicitly delete them, the memory those objects took still counted against you because of the timed gc system. Object pooling was absolutely required but even then you had to be very careful not to blow your memory budget.<p>The 'soft crash' would result in a situation where the app and overall runtime is still running but the state of the software is no longer reliable until you <i>reboot the TV</i>. And none of this stuff (the timed gc, etc) was documented at all, and there's little to no active community for "Yahoo Widgets" so you basically had to figure this all out on your own.
daloreabout 12 years ago
Managing memory in ECMAscript is hard.<p>These are the same problems from Actionscript (I know the crowd here has no love for AS though).
joubertabout 12 years ago
Most folks probably write JavaScript for the browser.<p>Not only should you consider using object pooling for JS objects (like the author describes), but you also want to think about DOM element pooling, especially when you are dealing with large lists.
评论 #5705531 未加载
评论 #5705615 未加载
alfredpabout 12 years ago
I would love to know if using emscripten will make memory usage more deterministic.
maasabout 12 years ago
why is Jay Kay from Jamiroquai teaching memory management?