Solved

Java Memory Problems using large Datasets

Posted on 2006-11-17
5
201 Views
Last Modified: 2010-03-31
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  

 
0
Comment
Question by:gdkinney_2
  • 3
  • 2
5 Comments
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17967001
It would be good idea to create array once and pass it around, creating new array involves a lot of memory
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17967012
i better approach would be - NOT to store the ResultSet in terms of array/vector, process it row by row!
0
 
LVL 24

Accepted Solution

by:
sciuriware earned 500 total points
ID: 17967029
Doesn't matter, you can calculate yourself how much of all those objects
will exist together; what you need to persist can't be local.

You could of course try to hold small numbers in short i.s.o. long
but I smell that it will not help you in your situation.

Start by running with a lot of initial memory:

java -Xmx1400m  or so, you will use the swapdisk of the system.

;JOOP!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 17967037
Note: I did not see the posts by Ajay-Singh.

Own remark: avoid growing array implementations like ArrayList

;JOOP1
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 17993634
:)
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
oracle 11g 23 106
MySqlDump not dumping triggers 1 43
Configure a Bean in an XML file 4 42
Cisco ASA: Java web start no go, asdm launcher no go 3 34
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question