Reputation: 129
How do I determine how large a single, specific class definition (not the instantiated object) is? Specifically, how much PermGen memory does a given class use? If it cannot be calculated, how roughly does it correspond to the filesystem size of the uncompressed .class file?
I've read Jon Masamitsu, on what PermGen holds:
The last two may possibly not be relevant to an individual class defintion. I'm interested in the rest.
The only possible approximation I've found is java.lang.instrument.Instrument.getObjectSize(myObject.getClass()); but the "some or all" in the description leaves me less than confident in the accuracy. Any ideas? I feel like I'm overlooking something simple.
Upvotes: 3
Views: 840
Reputation: 533820
The only thing you can do is look at the PermGen size is before and after loading a class, however it continues to use more memory as its methods get (re)compiled.
Upvotes: 3