Wednesday, December 31, 2008

Inaccurate permgen usage stats (jmap -permstat)

The jmap is a JVM memory inspection tool. "jmap -permstat pid" is the option to show the stats on the permgen (permanent generation) heap inside the JVM, where class metadata and interned strings are allocated.

I happened to find a bug in jmap. In a small test, the "jmap -permstat" command reports only about 50-60% of the permgen memory usage (compared to the actual usage of permgen based on what the "jmap" command reports). To fix it, I contributed the following patch to OpenJDK, which increases the number up to 80-90%:

http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/7f601f7c9b48
http://bugs.sun.com/view_bug.do?bug_id=6731726

Thanks to Martin Buchholz who submitted the patch on my behalf and Swamy Venkataramanappa and Daniel Daugherty for reviewing it.

No comments: