我正在尝试创建一个大小的数组2^32 = 4294967296
,因为我试图通过运行筛算法来获取 2^32 之前的所有素数。但是,该数组中的任何操作都会出现以下错误:
致命错误:CALL_AND_RETRY_LAST 分配失败 - 进程内存不足
中止陷阱:6
遇到上述情况我能做什么?
Arrays can't be that big, the maximum length is 232-1. According to ECMAScript http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects spec,
Every Array object has a length property whose value is always a
nonnegative integer less than 232.
A String property name P is an array index if and only if
ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal
to 232−1.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)