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%:

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

No comments: