I am trying to create an array of size 2^32 = 4294967296
, because I am trying to get all the prime numbers till 2^32 by running the sieve algorithm. However any operation in that array I get the following error:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Abort trap: 6
What can I do in above situation?
Arrays can't be that big, the maximum length is 232-1. According to ECMAScript 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With