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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Node.js Has 1 Gb Memory Limit

85 点作者 andreyvit超过 13 年前

13 条评论

mjijackson超过 13 年前
It would be more correct to say that V8 has a 1G memory limit. But node.js actually gives you these nice things called Buffers which, according to the node.js manual, are "similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap" (see <a href="http://nodejs.org/api/buffers.html" rel="nofollow">http://nodejs.org/api/buffers.html</a>).<p>Buffers are used all over the place in node, which should mitigate the degree to which this is actually a problem. Even if this bug report stays a wontfix, it won't affect my decision to use node because of Buffer support.
评论 #3007582 未加载
glenjamin超过 13 年前
It's probably worth mentioning that the GC cycles start to take upwards of one second at around 500mb of RAM usage with lots of small objects.<p>This limit doesn't stop you using NodeJS, but it's definitely something newcomers should be made aware of before they start writing database servers or making heavy use of a naive in-memory cache through an object literal.<p>Hopefully when the new GC gets rolled out we'll really be able to let loose with the RAM usage.
评论 #3007729 未加载
eric-hu超过 13 年前
Relevant snippets:<p>"diego.ca...@gmail.com, Sep 19, 2010<p>... In my case, I've been forced to suddenly stop my work ... with node.js because it cannot handle more than ~140K websockets concurrent connections ..."<p>"erik.corry, Nov 2, 2010<p>The limit for 64 bit V8 is around 1.9Gbytes now. Start V8 with the --max-old-space-size=1900 flag."
评论 #3007310 未加载
moomin超过 13 年前
There's a general point to be made here: this is the sort of thing that happens when you have "closed development open source". Admittedly, there seem to be very few people in the world capable of delivering a world-class GC.
andreyvit超过 13 年前
To add my own perspective: I was running some analytics batch job on Node and hit this limit, had to add multi-stage processing to accommodate it. Using --max-old-space-size=1900 did help a bit.<p>In case you're wondering, here's a test case: <a href="https://gist.github.com/1148761" rel="nofollow">https://gist.github.com/1148761</a><p>I was told by one of the V8 developers that the new GC is pretty usable now, so worth giving it a shot if you need more than 2 Gb.
eob超过 13 年前
What rude and demanding bug reports.
评论 #3007262 未加载
vr超过 13 年前
I guess the point of posting it here is to gather folks with pitchforks and torches demanding immediate attention to the issue. For a few months V8 team has been working hard on improving the GC (<a href="http://code.google.com/p/v8/source/browse/branches/experimental/gc" rel="nofollow">http://code.google.com/p/v8/source/browse/branches/experimen...</a>) which was the major limiting factor here. I don't have an ETA of when it's going to be merged, but the new GC branch is in a pretty good shape.
0x12超过 13 年前
This all boils down to using the right tool for the right task and knowing how to organize your code so you don't run in to limits in the platform components that you use.<p>In this case, the obvious solutions are to either use 'buffers' (think of them as extended memory from the old days) or to use multiple instances on the same machine or spread over several machines.<p>If you write your code in such a way that you end up handling all your users in a single process then you will sooner or later run in to some limitation.
chapel超过 13 年前
This has been long known and looks to no longer be a problem soon reading the comments of the OP. It hasn't been a serious issue as long as you know about it going in.
russellallen超过 13 年前
They're running up against a V8 limit.
评论 #3006654 未加载
wavephorm超过 13 年前
If there's anything I've learned in my software career, is that problems can be fixed. It sounds like this problem can, or already has been fixed. NodeJS is a wonderful platform to work with, nonetheless.
maxogden超过 13 年前
nice FUD headline
评论 #3007010 未加载
jrockway超过 13 年前
"C Has 16 Exabyte Memory Limit"