Skip to content

Resolving Out of Memory: PermGenSpace Issues

October 1, 2010
tags:

For analysis of Perm Gen space error the tools used were:
1. Visual VM (VVM)
2. Gcore
3. Jmap
4. Jstat
5. Eclipse Memory Analyzer tool (MAT)

The learning’s were:
1. Use the jstat tool to get the PermGen % usage(Option: -class) , collaborate this with the LoadedClass/Bytes taken by loaded classes (Option: -gcutil). MUST USE: -XX:PermSize along with -XX:MaxPermSize otherwise the value of P column that you see when using the gcutil option with jstat would be wrong and misleading !!.

2. Use the –XX:TraceClassLoading and –XX:TraceClassUnloading to determine the classes that are loaded/unloaded

Heap dumps taken by the jmap tool : jmap –heap:format=b

create the heap file which can be analyzed by the MAT/VVM tool. However, not much details of % usage of the PermGen can be seen – though one can see classes loaded by each class loader – and it is useful only in those cases where there is a classloader leak (As in unloading of web app not taking successfully).

Other than that – if the jmap is not producing a correct dump of the memory (too small a dump file etc) you can use the gcore utility to create the dump file. Thereafter you can extract a heap dump from jmap or directly open the gcore file the VVM tool and extract the heap dump. But the catch is the Visual VM should be running on the same machine with the same jvm from where the gcore was created!!! 🙂

Tomcat 7.0.2 does unload classes by time – but if bulk requests done at same time its behavior differs from serial single file jsp requests done while doing load testing.

Meaning of the – and + used the JVM options

  • Boolean options are turned on with -XX:+<option> and turned off with -XX:-<option>.
  • Numeric options are set with -XX:<option>=<number>. Numbers can include ‘m’ or ‘M’ for megabytes, ‘k’ or ‘K’ for kilobytes, and ‘g’ or ‘G’ for gigabytes (for example, 32k is the same as 32768).
  • String options are set with -XX:<option>=<string>, are usually used to specify a file, a path, or a list of commands
Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: