• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

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

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You've got things a bit messed up. It's
java -Xmx128m ClassName
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 22804
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
straws are for suckers. tiny ads are for attractive people.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic