Java Memory Problems using large Datasets
Posted on 2006-11-17
I am working on a Java Swing Application where I am initially generating a lot of data randomly and storing it in a Vector and a 2-D Object array. Without going into details I need to store it in both objects although depending on a user's selection one structure will have only the users selected records while the other Object contains all the cached data. We need to make it work with as many as 50,000 records and are running up against memory problems because a GOTS tool we are also using is a memory hog. We have 1Gig of memory on our workstations. More than one method in the class will access the large data structures.
My question is, memory wise for these large datasets, where the large arrays and Vectors will be used by more than one method in the class, am I better off making the arrays and Vectors class member variables? Or would it be better memory wise to declare the arrays and Vectors as local variables in a method and then pass them from method to method as parameters?