I am developing my own AI based on distribution functions, thus I would like to create and use big array of 8 GB. I already have 16 GB of RAM, thus HW is not problem.
I was able to create empty AI skeleton from PetraBot and run it inside 0ad (the AI does nothing, all units just stand there, no errors displayed in F9 console).
However, I am unable to create a 8 GB array. When I try using following code in the CustomInit() function
this.myArray =[];this.myArray.length =8000000000;for(var i =0; i <8000000000; i++){this.myArray[i]=1;}
I asked uncle Google and it looks like there is memory limit in JavaScript interpreters. Indeed, if I lower the array size to 1GB, no error happens in the F9 console.
The JavaScript interpreters allow to set the memory limit on command line, for example
node --max-old-space-size=8000 yourScript.js
but since 0ad is written in C++ and runs a JavaScript interpreter internally, I can NOT configure it.
Thus the question: How to increase memory limit for 0ad's JavaScript interpreter?
I am using Ubuntu 16.04 LTS. I compiled 0ad from SVN successfully.
I already read official documentation about AI development under 0ad and I also tried to search this forum, but no luck. I would be really grateful for any advice.
Increase memory limit for JavaScript interpreter
in Game Development & Technical Discussion
Posted
Hello everyone,
I am developing my own AI based on distribution functions, thus I would like to create and use big array of 8 GB. I already have 16 GB of RAM, thus HW is not problem.
I was able to create empty AI skeleton from PetraBot and run it inside 0ad (the AI does nothing, all units just stand there, no errors displayed in F9 console).
However, I am unable to create a 8 GB array. When I try using following code in the CustomInit() function
I get error in F9 console
I asked uncle Google and it looks like there is memory limit in JavaScript interpreters. Indeed, if I lower the array size to 1GB, no error happens in the F9 console.
The JavaScript interpreters allow to set the memory limit on command line, for example
but since 0ad is written in C++ and runs a JavaScript interpreter internally, I can NOT configure it.
Thus the question: How to increase memory limit for 0ad's JavaScript interpreter?
I am using Ubuntu 16.04 LTS. I compiled 0ad from SVN successfully.
I already read official documentation about AI development under 0ad and I also tried to search this forum, but no luck. I would be really grateful for any advice.