Garbage collection

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
[[Category:Memory]] [[Category:Troubleshooting]]

Revision as of 17:56, 7 November 2005

option description
-J-verbosegc turn on verbose garbage collection information (recommended)
-Xmx256m sets the maximum size of the heap (recommended)
-XX:MaxPermSize=256m sets the maximum size of the permanent heap (recommended)

The default values for both the maximum heap size and the maximum permanent heap area are too low. It is recommended to increase both values.


The MaxPermSize - the maximum size for permanent objects in the heap - is a separate space from the heap size specified by -Xmx. Several Resin users have found excessive garbage collection times even when there is plenty of heap space available as reported by -J-verbosegc. In many of these cases, increasing the MaxPermSize solves the issue.

Because MaxPermSize is a maximum size, it is safe to increase its value even if you do not know if your application will actuall need that space.

Solving excessive garbage collection times

First, enable -J-verbosegc or something similar in a debugging tool to get an idea of what the JVMs garbage collection is doing.

Second, make sure both -Xmx and -XX:MaxPermSize are large enough. If the debugging output shows a large number of "FullGC" but there appears to be enough heap space, then the MaxPermSize should probably be increased.

Personal tools