Solved

Java Memory Problems using large Datasets

Posted on 2006-11-17
5
203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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…
Suggested Courses

710 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