gdkinney_2
asked on
Java Memory Problems using large Datasets
Hi,
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?
Please help,
Dave
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?
Please help,
Dave
It would be good idea to create array once and pass it around, creating new array involves a lot of memory
i better approach would be - NOT to store the ResultSet in terms of array/vector, process it row by row!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Note: I did not see the posts by Ajay-Singh.
Own remark: avoid growing array implementations like ArrayList
;JOOP1
Own remark: avoid growing array implementations like ArrayList
;JOOP1
:)