I have written a program that uses 2 million arrays of integer values. However, it only uses 200 arrays at a time.
I have 200 intelligent cars that move over a terrain of 10 000 blocks (divided according to GPS values). Each block has an array of 129×28 that has integer values. When any car moves into a new block, it must retrieve the array which is related to this block then it uses a value in that array. Then it makes a decision based on that value, then it moves on and so on. So the entire system of 200 cars and 10 000 blocks, while each car has its own array distinct values, the total number of arrays is 2 millions. I need to simply retrieve 1 array of each car at a time slot = 200 arrays at a time
the arrays will be created and filled with zeros at the start by the application, then the application will start filling those arrays, finally it will only use them. so I wrote a code to create those arrays in the program.
can’t I store the arrays in files on HD and retrieve them when I want?
Update
Since I had 2 million arrays and I can’t store & retrieve 200 arrays in 1-1.9 seconds I down-graded the research to use less environment features and ended up with with using 2 million arrays of size 7 x 28. which used 7 * 28 * 10 000 * 4 (integer) * 200 (cars) bytes
which consumed only 1.6 GB if RAM. Good luck if you’re having similar problem, PM if you are in a similar situation and I hope I will be able to help.
One reasonably easy solution is to use the ObjectOutputStream and ObjectInputStream classes to write and read your arrays.
Here is some example code to write an array to disk:
Here is some example code to read a previously saved array from disk: