To do some benchmarking, I tried to create a huge array. The code was simple:
var hugeArray = [];
for (var i = 0; i < 2*1000*1000*100; i ++) {
hugeArray.push(Math.ceil(Math.random()*100))
}
console.log(hugeArray.length);
After I run it with 200 million elements, I get FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory
. With 20 million elements, this works well, so I assume I need to change some setting.
I am using MacOS with 8 GB of RAM, if that helps.