• 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

How many Java Classes can be loaded

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Saloon Keeper
Posts: 27819
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Tim Holloway
Saloon Keeper
Posts: 27819
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for information Tim, but I dont understand about the name thingy. I am using my real name.
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
 
Maybe he went home and went to bed. And took this tiny ad with him:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic