java - Why would jmap -permstat report more than MaxPermSize bytes used? -
i've taken jmap -permstat
output of jvm (reported version 24.76-b04), reports following totals:
total = 5190 76930 1031431696 n/a alive=1, dead=5189 n/a
which should number of entries, classes using information, bytes used metadata , liveness information.
now, wonder why report 1031431696 bytes
, shy of gigabyte when startup vm -xx:maxpermsize=256m
. can shed light on how number calculated?
don't know if it's relevant using rhino ~3k entries being definingclassloader
s.
i have looked bit @ code jmap -permstat
implementation. bytes used value estimation based on sizes different types of data classloader loads (methods, fields, interfaces etc).
the top level method size calculation loaded class sun.jvm.hotspot.tools.permstat.computesize
:
private long computesize(instanceklass k) { long size = 0l; // instanceklass object size += k.getobjectsize(); // constant pool constantpool cp = k.getconstants(); size += cp.getobjectsize(); size += objectsize(cp.getcache()); size += objectsize(cp.gettags()); // interfaces size += arraysize(k.getlocalinterfaces()); size += arraysize(k.gettransitiveinterfaces()); // inner classes size += objectsize(k.getinnerclasses()); // fields size += objectsize(k.getfields()); // methods objarray methods = k.getmethods(); int nmethods = (int) methods.getlength(); if (nmethods != 0l) { size += methods.getobjectsize(); (int = 0; < nmethods; ++i) { method m = (method) methods.getobjat(i); size += m.getobjectsize(); size += objectsize(m.getconstmethod()); } } // methodordering - int array records original // ordering of methods in class file size += arraysize(k.getmethodordering()); return size; }
my guess estimation fails horribly in case. reason fails hard without checking object size calculations in detail jvm version in combination characteristics of loaded classes in application.
also, troubleshooting guide java se 6 hotspot vm mentions value approximation.
bottom line, take bytes used value grain of salt.
Comments
Post a Comment