File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding JVM options with Heap size and PermGenSpace

 
RaviNada Kiran
Ranch Hand
Posts: 528
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As docs say

MaxPermSize specifies the size for a heap that holds objects such as classes and methods.

Are these huge number of classes related to the loaded classes/or which are written as part of Application development??

So what is the difference between a Heap size and PermGenSpace?




Thanks in advance.
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RaviNada Kiran wrote:So what is the difference between a Heap size and PermGenSpace?


You have pretty much described it. The Permanent Generation is where the JVM keeps class descriptions. And yes, these are the classes you have written when you develop an application. I would only increase it's size if you get an OutOfMemoryError indicating that the JVM has run out of PermGen space. The number of classes in an application is not very dynamic, so we don't see this situation very often (the exception being application servers, which get a new influx of class descriptions every time an application is redeployed).
The Heap is where the JVM creates class instances. The heap is far more dynamic than the PermGen and more susceptible to running out of memory.
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Ess wrote:
RaviNada Kiran wrote:So what is the difference between a Heap size and PermGenSpace?


I would only increase it's size if you get an OutOfMemoryError indicating that the JVM has run out of PermGen space.

Thanks Joe.


so you mean to say that the log files will indicate PermGen space and then i need to increase -XX

why i am asking because if i get OutOfMemoryError i would be only increasing the xms and xmx options only. But i have never done -XX option.
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RaviNada Kiran wrote:
so you mean to say that the log files will indicate PermGen space and then i need to increase -XX


Correct. Here's one that recently happened to an application I maintain:

 
RaviNada Kiran
Ranch Hand
Posts: 528
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Ess wrote:
RaviNada Kiran wrote:

Correct. Here's one that recently happened to an application I maintain:





Hope you solve it early. Thanks a lot for explanation.
 
Ashok Sharma
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi RaviNada Kiran/Joe Ess,
i am still not clear with the use of these two marameters (heap size and permanent generation space).
Could you put more light on this?

In my appliaction this configuration is getting used
-Xms128m -Xmx1024m -XX:PermSize=64M -XX:MaxPermSize=256M

I am not sure whether we can keep mx greter then MaxPermSize, in my case mx=1024 and MaxPermSize=256?

Thanks in advance.
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the size of the permanent generation varies from application to application, there's no way for us to tell you what those settings should be.
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XMS and XMX are parameters for your running application which is dynamic and which depends upon the Threads(Requests) which are accessing your application and often requires Object creations .(so this indicates what should be the initial and final memory allocated to them)

and PermGen space is the space for your classes declarations created as part of your application.

 
Ashok Sharma
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for you reply,
So is memory allocated to MaxPermSize is a part of memory allocated to Xmx?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic