The problem is like this:
I am retrieving latitude and longitude from a point and storing it into an agent class.
The class has the members id, latitude and longitude and assosciated functions.
Now at the start of the java app, it reads all rows from a local MySQL table(having cordinate values) and stores it into an arraylist of these agent variables. It then reads through this arraylist and calls necessary functions and draws a graph at the end.
This works fine for a table of 8K – 10K rows but then for another table with about 200,000 rows, it starts giving Heap size error in java.
I am thinking of changing the code to access the db everytime coordinates of an agent is needed. This should reduce the memory required right? However, there are many loops using the Iterator of this agent ArrayList. I am still in a fix on how to handle that.
So which would be a better option – reading from the table everytime or proceed as it is and increase the java memory allocation?
Thanks for reading.
try to only load data as you need it. We don’t have very much information, but I am assuming there is no need for the user to see/interact with all 10,000 data points at once. Besides the physical limitations of the size of the device screen, realistically a user will just be overwhelmed with that much information.
I would try implementing a paging system. Again, I have no idea what you are using the
Agentclass for, but try to only load as manyAgents as you are showing to the user.