Java Heap Space : ArrayList<Integer>
I am expected to process 50,000,000 records from a database. I take 100,000 records at a time store it in ArrayList<Integer> at a time in order to process. I use 64 bit windows machine and I have increased the heap space as much as possible
java -Xms500m -Xmx1500m Codename
I choose ArrayList instead of Hashmap since it not a specific search for records but rather looping through the whole list. Few research study in google advised me to choose arraylist over hashmap.
But I still get java.lang.OutofMemoryError: Java heap space. What is so weird is I get this error after processing every 5,000,000 records..which I dont understand at all...
But anyway the question is using ArrayList<Long> over ArrayList<Integer> will it improve the performance. As far as I know values stored in the ArrayList when it is a number and needs more bit space we have to use Long instead of Integer. Is my understanding right? Please correct me if I wrong.. And if you have suggestion for my heap space problem I would really appreciate..