wood burning stoves 2.0*
The moose likes Java in General and the fly likes JVM Out Of Memory...How to increase Heap Size?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "JVM Out Of Memory...How to increase Heap Size??" Watch "JVM Out Of Memory...How to increase Heap Size??" New topic
Author

JVM Out Of Memory...How to increase Heap Size??

Praveen K Pippiri
Greenhorn

Joined: Jun 17, 2002
Posts: 23
Hi All,
I am having a java program which is running on a UNiX Machine and giving JVM Out Of memory error.This program accesses database and read some data (CLOB and BLOB on DB2 UDB..no need to bother about this ).As the data size is more than 9MB it is failing to allocate so much memory and giving the Out Of memory Exception.
I am thinking that if we change the JVM heap size or the Memory allocated to the Process then the problem will be resolved.
How do change the Heap Size?
I have refered some documents in web saying that we can heap size in the from comman prompt when we invoke the JVM by passing the JAVA_ARGS="-Xms64m -Xmx96m" argument
Does it mean like below?
java <ClassName> JAVA_ARGS="-Xms64m -Xmx96m" (assuming there is no jvm running already)
I don't need to set the Heap size programatically.But I am not finding this java Args option anywhere in my jre bin ir lib directories..
Some documents mentioned that we can modify jvm.config file but I don't find any document named by that.
Could you please advice me where and how to change this parameter or how do I solve this problem??
Thanks in Advance


Praveen<br />Sun Certified Programmer for Java 2 Platform.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

You've got things a bit messed up. It's
java -Xmx128m ClassName


[Jess in Action][AskingGoodQuestions]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
If you installed the Java Documentation, you should have a tooldocs directory - start at the tools.html file to locate details on all of the memory related command line settings.
muthu muruges
Ranch Hand

Joined: Feb 28, 2003
Posts: 70
Are you getting the OutOfMemoryError during the startup or after some days from the day of starting?
If it is during startup then the big heap size will help to solve your problem. Otherwise I assume that your program is having memory leak. better to profile your code using some profilers.
Praveen K Pippiri
Greenhorn

Joined: Jun 17, 2002
Posts: 23
I can't imagine how did I make such a silly mistake..
So far I was using java <classname> <reqdargs>
I don't know why I was making this mistake.Now I interchanged the arguments.
I tested in a sample program and it is allocating the reqd memory.Let me Test my application.
I want to know about the profilers.What is this??Can you tell me where will
I get more info on this??
Thanks a lot for your adivce.
muthu muruges
Ranch Hand

Joined: Feb 28, 2003
Posts: 70
Profiler(like OptimizeIt) helps you to find out the memory leaks in your application. With that you can find out the dead-locks if your appln. if it is a multithreaded one.
You can try with the evaluation copy of OptimizeIt downloadable at the borland web site
Vipin Nair
Greenhorn

Joined: Mar 24, 2008
Posts: 6
Praveen K Pippiri wrote:I can't imagine how did I make such a silly mistake..
So far I was using java <classname> <reqdargs>
I don't know why I was making this mistake.Now I interchanged the arguments.
I tested in a sample program and it is allocating the reqd memory.Let me Test my application.
I want to know about the profilers.What is this??Can you tell me where will
I get more info on this??
Thanks a lot for your adivce.



Hi Praveen ,

I am facing the same exception.
I did java -Xmx300m Input
Input is the class name.
But everytime I run this comand in cmd prompt, I get No Class Def Found Error.
I am first going to the directory of this particular class and then running the command.
Vipin Nair
Greenhorn

Joined: Mar 24, 2008
Posts: 6
Hi All,

I am fetching a Clob column from DB through Java programming.
I am just assigning the clob data to a string object and have to do some string manipulations to get the XML data of the Clob.
Then i am writing those manipulated values to an excel sheet.
Here the issue is with the clob data.
I am unable to fetch for more than 4000 records from clob column and write to excel.
Every time it throws me Java Heap Space: Out of memory exception.
I had tried modifying my code and then reached to 4000 records.
Please let me know how to use the cmd prompt options, because everytime I use this option I am getting No Clas def Found Error.
My target is to fetch 10000 records and write to excel sheet.
Vipin Nair
Greenhorn

Joined: Mar 24, 2008
Posts: 6
I am using jre 1.6 and RAM is 1.87 GB.
Can anyone let me know whats the exact cmd prompt statement which i should use or any other work around for this issue?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19726
    
  20

Don't worry about the memory for now - focus on the NoClassDefFoundError. Is it the "Input" class that is causing the problems, or another class? How are you executing your class when you get the OutOfMemoryError?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JVM Out Of Memory...How to increase Heap Size??