I want to write a program that will let me know all the currently loaded classes in the current JVM and the number of instantiations for each loaded class. Reflection allows me to inspect a class. Is there anything in Java to allow me to inspect the JVM itself ? Thanks Pho
First you write a JVM . . . . . No - seriously - each JVM is slightly different depending on who wrote it. If you write your OWN JVM you can keep track of such things (which is how tools like IDEs do it), but I don't know of any such thing that is required in the Specification for JVMs.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Cindy, I was actually asked this in an interview! I'm sure it couldn't be that hard considering that there are profiler tools that can do this by attaching itself to a running JVM. See http://www.vmgear.com/Pallocationview.html I'm asking this question because I'm doing an audit of my interview "performance" as there were a couple of questions which I fumbled. Thanks Pho [This message has been edited by Pho Tek (edited November 07, 2001).]
Joined: Sep 29, 2000
Well, then they have figured out something that I haven't (not too surprising actually ). When you figure it out, can you come back and fill us in?
[This message has been edited by Cindy Glass (edited November 08, 2001).]
subject: Finding out # of instantiations of a class