TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Managing Memory in Javascript is Hard

33 点作者 superfreek大约 12 年前

6 条评论

davidw大约 12 年前
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 未加载
georgemcbay大约 12 年前
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.
dalore大约 12 年前
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).
joubert大约 12 年前
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 未加载
alfredp大约 12 年前
I would love to know if using emscripten will make memory usage more deterministic.
maas大约 12 年前
why is Jay Kay from Jamiroquai teaching memory management?