If I'm given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is:
How will the larger, mostly unused library affect the application's performance? Does the JVM do lazy loading of classes, does having a larger class library necessarily mean a larger memory footprint?
The short answer is that classes are loaded whenever they are first needed. Note that "needed" also means "referenced by any other class that is being loaded".
So if you have a whole pile of classes that are never touched by any active code, it will not be loaded.
If you would like to see exactly which classes the JVM is loading and when, you can invoke the java command/process with the -verbose:class option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With