Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PermGen - OutOfMemoryError

Posted on 2009-07-13
14
Medium Priority
?
336 Views
Last Modified: 2013-12-29
I have a client application that run into OutOfMemoryError after having been running for a pretty short time, a couple of hours. I have increased the size of it, but it doesn't seem to have any effect. The error still shows up. What can I do to solve this? Is it bad coding of some sort? I don't just want to create more space unless there is a good reason for it.

The JVM is 1.5
0
Comment
Question by:mdoland
  • 3
  • 3
  • 3
  • +3
14 Comments
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 24840707
It could be a multitude of things, especially as you eluded too a code error (memory leak).  Large objects that are not being properly disposed of once they are no longer being used that new instances get created for over and over in course of application execution.  If you have an idea of the class / method specifically being executed when you get this error (maybe through the stack trace -- can post in code snippet here) you can paste that classes code here in a code snippet for evaluation.

Regards,
Kevin
0
 
LVL 2

Expert Comment

by:Ken Clement
ID: 24840763
The problem as you describe it is almost certainly a coding issue.  It is most likely that objects are being allocated that the garbage collector cannot touch because references to them still exist somewhere.  Another possibility is that objects are being allocated at such a rate between the normal garbage collection cycle that memory is exhausted before the garbage collector even has a chance (from your description though, I'd heavily lean to the first explanation).

Look to profile the client application (let us know if you are unsure how to do that) monitor the memory usage; if it is monotonically increasing that is a smoking gun for explanation #1.  You will then need to determine why the application allocates and tends not to return memory.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24840874
Your title 'PermGen' gives me a clue that you could be permuting a collection. Unless you're reusing the memory for each permutation, e.g. if you were somehow adding to the memory usage, the numbers can quickly reach stratospherice levels
0
Industry Leaders: 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!

 
LVL 60

Expert Comment

by:Kevin Cross
ID: 24841007
Here is some information on PermGen (permanent generation in JVM):
http://www.brokenbuild.com/blog/2006/08/04/java-jvm-gc-permgen-and-memory-options/

There are some links that should help in determining which classes are being put into PermGen and whether or not increasing the MaxPermSize will be a good idea for you or will just delay the amount of time between the issues as you just give more memory to be leaked before application dies.  However, it could be as your memory could just be getting exhausted as such a fast rate that garbage collection doesn't get to occur as KenClement pointed out as scenario #2 above.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24841235
Ahh it's *that* kind of PermGen.. ;-)
0
 

Author Comment

by:mdoland
ID: 24842722
To clearify: This is what I am talking about:
http://www.freshblurbs.com/explaining-java-lang-outofmemoryerror-permgen-space

The product is a mature product that is used by very many people. We have never experience this problem, and suddenly after a new release, it occurs in the client.

We increased the size to 90 from the default 64, but it shows upp pretty fast anyway.
0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 24842794
Is there error message occurring on each individual client OR on the system hosting the application since you indicated "that is used by very many people".  

If by that statement, you meant the product is a mature boxed application that itself has a heavy user base, then check the community/forum for your application vendor and/or their support site to see if this new version has know memory leak issue that they may have a patch for.  You may find others have found an appropriate setting like PermSize=192m / MaxPermSize=192m or fix to the root issue if it is not based on the permanent heap size itself.

Best regards,
Kevin
0
 
LVL 2

Accepted Solution

by:
Ken Clement earned 800 total points
ID: 24843554
Reference:
http://www.alessandroribeiro.com/?q=en/node/33
http://www.alessandroribeiro.com/?q=en/node/39
http://www.alessandroribeiro.com/?q=en/node/41

Relevant Quote: (??)
"The Java language features dynamic class loading, so classes will be loaded on demand and the permgen heap size will grow as well. But, if in the long term, your permgen area is still steadly growing, you are probably using some kind of bytecode generation framework which is misbehaving or you are using it incorrectly. Analyse that and rethink what you are doing."
0
 
LVL 92

Expert Comment

by:objects
ID: 24844817
do a diff on the two releases to get an idea as to what has triggered it.
0
 

Author Comment

by:mdoland
ID: 24846997
Are there any potential risks in setting up those values? I plan to put it up to 128m and 192m.
0
 
LVL 92

Expert Comment

by:objects
ID: 24847006
not really, assuming the memory is available on the box
0
 

Author Comment

by:mdoland
ID: 24847017
And as I understand, it is not taken from the rest of the heap, right?
0
 
LVL 92

Assisted Solution

by:objects
objects earned 800 total points
ID: 24847042
correct, its a seperate allocation
0
 
LVL 6

Assisted Solution

by:jwenting
jwenting earned 400 total points
ID: 24849021
PermGen problems are almost universally caused by calling (implicitly or explicitly) String.intern() frequently.
Eclipse for example has this in some versions when working extensively with XML and HTML/JSP files.

Some XML parsers may do this as well, and especially classes that implement the Cloneable interface and use String.intern() to create deep copies of String fields (usually an unnecessary precaution).
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This video teaches viewers about errors in exception handling.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

972 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