Results 1 to 4 of 4
Thread: [SOLVED] JAVA heap size problem
- 02-11-2009, 06:50 AM #1
Member
- Join Date
- Feb 2009
- Posts
- 1
- Rep Power
- 0
[SOLVED] JAVA heap size problem
Hi,
I am facing java heap size problem while running the code.
My code is very simple, but it has several single and 2 dimentional arrays of size 3619 and 3619x3619. I run my code in Eclipse. It gives me the below error :
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
My code stops at the declaration of the the array
double[][] sample=new double[3619][3619];
Can u tell me how to increase heap size in "Eclipse"?
What are the jav memory limitations?
-
I'd look at the Run -- Open Run Dialog -- Arguments tab -- VM arguments
But don't hold me to this.
- 02-11-2009, 07:00 AM #3
Member
- Join Date
- Oct 2008
- Posts
- 68
- Rep Power
- 0
Think about how much memory you are allocating. JVM by default allocates some memory which may not be sufficient.
do you know how much memory double variable needs? calculate based on that and then you can use -X option to allocate the memory for your program as shown below
java -Xmx256m <your class>
this is example for 256MB ...you can use any memory physically available for JVM.
____________________________________________
Priya,
Cooking is Fun | Eat Healthy Stay Fit | Sweets | Raita | Bread | Dal| SnacksCheers,
Eat Healthy Stay Fit
- 02-11-2009, 07:05 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Your application has a memory leak me be. Did you try anything work around with the garbage collector within the code. It may helpful to prevent this.
In default Java heap is 128MB, but in some project it's not enough. Run time you can increase it with the following command.
I'm not an Eclipse user, but there should be a way to config this. May be through a project config file.java -Xms<initial heap size> -Xmx<maximum heap size>
Did you search the forum? Same question is discuss several times here.
Additionally, following thread explain this on NetBeans. Not directly related with your question, but it can be helpful to you.
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Similar Threads
-
Problem while writing to file, size greater than 15MB ..?
By prabhurangan in forum New To JavaReplies: 3Last Post: 12-30-2008, 05:28 PM -
Java heap size
By jmdrocks in forum EclipseReplies: 2Last Post: 12-12-2008, 06:10 AM -
Java Heap Space
By sandeeprao.techno in forum Advanced JavaReplies: 19Last Post: 10-30-2008, 11:27 AM -
Java heap space?
By javanewbie in forum New To JavaReplies: 1Last Post: 06-24-2008, 06:55 PM -
Heap Sort in Java
By Java Tip in forum AlgorithmsReplies: 0Last Post: 04-16-2008, 10:27 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks