Why would I see only "dead" classloaders from jmap -permstat (except the bootstrap)?
We've been pushing the permgen memory space in our app higher and higher and I'm trying to find out if we have a leak of some sort eating into the permgen area. We don't do hot undeploy/redeploy actions, but we have plenty of proxies, both dynamic and CGLIB-generated. We also do some complicated classloader bits to support various use cases, and I'm suspecting that these might also be a possible contributor to permgen wastage.
So I run jmap -permstat on our running app, hoping to get some insight into what might be filling up our permgen space. (I also run a normal heap dump with both live and dead objects so I can trace down clues that might come from the per开发者_如何学Cmstat output).
However, out of the 2400 classloaders listed by jmap permstat, ALL but the bootstrap classloader are listed as "dead". This doesn't make sense, since the app is definitely live, and working.
My understanding was that jmap would report a classloader as "dead" if it were eligible for garbage collection but I must be wrong here...
What am I missing? What does "dead" mean here? Googling around doesn't provide a lot of answers other than the possible misunderstanding that I have here.
Here are a few ideas:
- Upgrade to the latest VM.
- If for some reason you're running with
-XX:+UseConcMarkSweepGC
, then make sure you're also using-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
- Do a "Reference Chains from Rootset" in jhat in order to see who’s holding the instance. Remember to exclude weak refs!
- This long post is a little complicated, and I haven't tried it myself, but maybe it'll help you.
- Try another VM, e.g. JRockit
精彩评论