I am trying to generate arrays of type double, which can reach sizes in excess of 60 million. Moreover, I need to iteratively generate larger and larger arrays (begin with say 20000, iterate through my code x no. of times successively inflating my array size by a factor of 10 or 2, depending on the output in an iteration). At the end of each iteration i, I am setting the reference of my array of size xi to null, then pointing it to a newly generated array of size x(i+1) which is > xi. However, I am eventually running out of memory in eclipse with the usual Java Heap space out of memory error. I tinkered with the Xmx, Xms values in the eclipse.ini but with no luck. I also tried the System.gc() to suggest garbage collection to java after setting the array reference to null, again with no luck.
I need these large arrays because I am simulating a random process, collecting its output in these arrays (so I am using some additional objects to generate this array which also use up some memory). Then I feed this array to my main algorithm which performs a set of statistical computations on it. I get the out of memory error while generating the array with additional number of observations.
Is there anyway that I can overcome this out of memory issue? Would setting individual elements of array to null instead of the array itself help in freeing up the memory? Thanks in advance for for any advice.