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?
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.
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
Joined: Jun 19, 2008
Thanks for information Tim, but I dont understand about the name thingy. I am using my real name.
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.