aspose file tools*
The moose likes Performance and the fly likes How many Java Classes can be loaded Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "How many Java Classes can be loaded" Watch "How many Java Classes can be loaded" New topic
Author

How many Java Classes can be loaded

Kashif Mughal
Ranch Hand

Joined: Jun 19, 2008
Posts: 44
Hi Guys,

I want to know if there is any limit on the number of java classes to be loaded at bootstrap loading in a single JVM? Also, if we have extra classes loaded how it effects perfomance and memory ? If there is any best practices?


Thanks in Advance,
Kash.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

If there are any fixed-size resource tables in the JVM, I don't know about them. Back before about 1975, such things were commonplace, and one of the primary jobs of the OS support team was to tune these things as part of the install process for software (known as SYSGEN). However, that was when the physical RAM available was limited to 16MB or less for the entire (mainframe) computer.

Modern-day software relies more on expandable resource managers, such as hashes and linked lists. These constructs can expand to fill all available memory. although performance may suffer if the organization of the information isn't optimal for its contents.

In the general vein of KISS (Keep It Simple), less classes are going to be better most of the time, since the more complex the program, the more places bugs can be found. However, using pre-debugged libraries can offset or even reverse that rule to a degree - not only are you being supplied with pre-debugged code, but you may be able to cut down on repeated code.

Also, some libraries will invite in others, so the total class count will rise faster.

And yes, the more classes you load, the longer it will take to stream them in and internally deploy them.

However, having said all that, I don't recommend making the total number of classes be a defining limitation on application design. It's far better to simply make the application design itself cleaner and simpler.


Customer surveys are for companies who didn't pay proper attention to begin with.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

Oh yes, that reminds me. We don't have many rules here at the JavaRanch, but we do like to pretend we're all professionals, so we insist that people use their real names. For more information, see here: http://www.javaranch.com/name.jsp
Kashif Mughal
Ranch Hand

Joined: Jun 19, 2008
Posts: 44
Thanks for information Tim, but I dont understand about the name thingy. I am using my real name.
tapeshwar sharma
Ranch Hand

Joined: Mar 10, 2006
Posts: 245

I want to know if there is any limit on the number of java classes to be loaded at bootstrap loading in a single JVM?


I don't think that a JVM would ever say "n" number of classes are allowed.
In hotspot JVM, there is some thing called "Perm Gen Space",the part of the heap which is used for storing loaded class and method objects.
However, it is restricted by memory size, not the number of classes loaded.
However, jRocket works differently.I don't know about other JVMs, but I have serious doubts about "Number of classes" being a configuration parameter.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How many Java Classes can be loaded
 
Similar Threads
How to find the Time of class loaded by jvm
Instrumenting Core Java Classes
Class loaders
What happen when import the same package more than one time in the given class.
static block