aspose file tools*
The moose likes Java in General and the fly likes Regarding JVM options with Heap size and PermGenSpace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Regarding JVM options with Heap size and PermGenSpace" Watch "Regarding JVM options with Heap size and PermGenSpace" New topic
Author

Regarding JVM options with Heap size and PermGenSpace

RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
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.


If you want something you never had do something which you had never done
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
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

Joined: Oct 29, 2001
Posts: 8927
    
    9

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

Joined: Jan 30, 2009
Posts: 528
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

Joined: Dec 08, 2008
Posts: 12
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

Joined: Oct 29, 2001
Posts: 8927
    
    9

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

Joined: Jan 30, 2009
Posts: 528
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

Joined: Dec 08, 2008
Posts: 12
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
 
subject: Regarding JVM options with Heap size and PermGenSpace