Node.js(和 chrome V8)中的内存限制 [英] memory limit in Node.js (and chrome V8)

查看:48
本文介绍了Node.js(和 chrome V8)中的内存限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在网络的许多地方,您会看到:

In many places in the web, you will see:

节点进程的内存限制是多少?

What is the memory limit on a node process?

和答案:

目前,默认情况下,V8 在 32 位系统上的内存限制为 512mb,在 64 位系统上为 1gb.可以通过将 --max-old-space-size 设置为最大 ~1gb(32 位)和 ~1.7gb(64 位)来提高限制,但建议您将单个进程拆分为多个 worker如果您遇到内存限制.

Currently, by default V8 has a memory limit of 512mb on 32-bit systems, and 1gb on 64-bit systems. The limit can be raised by setting --max-old-space-size to a maximum of ~1gb (32-bit) and ~1.7gb (64-bit), but it is recommended that you split your single process into several workers if you are hitting memory limits.

由于 Node.js 似乎经常更新,所以有人可以确认是这种情况吗?

更重要的是,在不久的将来会是这样吗?

我想编写可能需要处理 4gb javascript 对象的 JavaScript 代码(速度可能不是问题).

I want to write JavaScript code which might have to deal with 4gb of javascript objects (and speed might not be an issue).

如果我不能在 Node 中完成,我最终会在 Java(在 64 位机器上)完成,但我宁愿不这样做.

If I can't do it in Node, I will end up doing in java (on a 64bit machine) but I would rather not.

推荐答案

这一直是一些使用 Node.js 的人的一个大问题,并且有好消息.V8 的新内存限制现在对于 64 位是未知的(未测试),并提高到 32 位环境中允许的 32 位地址空间.

This has been a big concern for some using Node.js, and there are good news. The new memory limit for V8 is now unknown (not tested) for 64bit and raised to as much as 32bit address space allows in 32bit environments.

在此处阅读更多信息:http://code.google.com/p/v8/issues/detail?id=847

这篇关于Node.js(和 chrome V8)中的内存限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆