Java heap dump can be generated with jmap. The content of a memory dump can be queried with jhat.
-XX:+PrintClassHistogram