• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

number of classes loaded..

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
When a class is first encountered in code, it is loaded into memory by the JVM. I wanted to know is there a way we can know the number of such classes, i.e., which are loaded by the JVM.
Hope my question makes some sense.
Thanks in Advance,
Basu.
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Java 1.5, JMX will provide a class/method to do this. It doesn't help for now, but it's worth keeping in mind for the future.
How come you need/want to know how many classes are loaded?
 
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are a few JVM querying tools out there.
For what you want to do, I'd try JMP - it's free and simple. I've had limited success with it - it seems to work OK for small programs, but I was unable to profile a larger (1000 class / 500k line) J2EE app. I'm using Java 1.3.1 so that may play a part.
Anyway, you can get JMP from http://www.khelekore.org/jmp/. Installation wasn't too difficult, and the end result is you do java -Xrunjmp MyMainClass to get a few windows with stats about classes loaded, methods called etc.
On a side note, if anyone has had success on bigger projects with any free profilers I'd be keen to hear from them.
Hope this helps.

--Tim
 
V Chauhan
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the answers..
The reason why I want to know about this is, there is a weblogic configuration parameter (maxPermSize) which impacts the number of classes that can be loaded into JVM. So I wanted to do some testing to co-relate the value of this parameter and the number of classes loaded successfully.
Let me see if JMP can be useful for me bcoz its a J2EE app with thousands of class files.
Basu.
 
Tim West
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mine is also a WebLogic app - from what you say I imagine they're of the same order of magnitude.
I couldn't get it going - it'd work until it'd loaded maybe 90 classes during WebLogic startup, then hang.
If you manage to get it going let me know how!
Cheers,

--Tim
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic