V8/Node.js 增加最大允许字符串长度 [英] V8/Node.js increase max allowed String length

查看:53
本文介绍了V8/Node.js 增加最大允许字符串长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AFAIK V8 对允许的长度有一个已知的硬限制<代码>字符串s.尝试解析 >500MB 的字符串会弹出错误:

AFAIK V8 has a known hard limit on the length of allowed Strings. Trying to parse >500MB Strings will pop the error:

Invalid String Length

使用 V8 标志来增加堆大小没有任何区别

Using V8 flags to increase the heap size doesn't make any difference

$ node --max_old_space_size=5000 process-large-string.js

我知道我应该改用 Streams.但是有没有办法增加允许的最大 String 长度?

I know that I should be using Streams instead. However is there any way to increase the maximum allowed String length anyway?

更新:下面@PaulIrish 的回答表明他们将其提高到 1GB - 但它仍然不是用户可配置的

Update: Answer from @PaulIrish below indicates they upped it to 1GB - but it's still not user-configurable

推荐答案

抱歉,没有,没有办法增加允许的最大 String 长度.

Sorry, no, there is no way to increase the maximum allowed String length.

它在源代码中是硬编码的,并且很多代码都隐含地依赖它,所以虽然允许更大的字符串出现在人们的愿望清单上,但这将是很多工作并且不会发生在不久的将来.

It is hard-coded in the source, and a lot of code implicitly relies on it, so while allowing larger strings is known to be on people's wishlist, it is going to be a lot of work and won't happen in the near future.

这篇关于V8/Node.js 增加最大允许字符串长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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