jvm load too many classes
Dr Andrew John Hughes
ahughes at redhat.com
Sun Aug 1 15:35:29 UTC 2010
On 31 July 2010 21:31, Rémi Forax <forax at univ-mlv.fr> wrote:
> Le 30/07/2010 21:59, Mandy Chung a écrit :
>>
>> Osvaldo Doederlein wrote:
>>>
>>> I wonder if these numbers have some variation per platform?
>>
>> Yes, there are some platform-dependent classes and so some loaded
>> classes are different on different platform.
>>
>>> For me (on
>>> Windows; 32-bit JDKs), the results of this test (java -verbose:class |
>>> grep Loaded | wc -l) are:
>>>
>>> 1.5.0_22: 239
>>> 1.6.0_21: 274
>>> 1.7.0-ea-b103: 403
>>>
>> I ran the helloworld. The number of loaded classes running different jdk
>> versions are fairly close. What test case did you use?
>>
>> $ grep Loaded hw.verbose.jdk5u22 | wc -l
>> 303
>>
>> $ grep Loaded hw.verbose.jdk6u21 | wc -l
>> 323
>>
>> $ grep Loaded hw.verbose.jdk7 | wc -l
>> 329
>
> There is a big diff (at least on linux) if you just try to print the help of
> the VM,
> i.e pass no argument.
>
> jdk1.6.0_21: 274 classes
> jdk1.7.0b103: 364 classes
>
> I join the diff.
>
> Some classes of java.text.*, java.util.ResourceBundle* and
> some classes related to locale and currency are loaded eagerly.
>
> Rémi
>
>>
>>
>>> The diff from 1.5 to 1.6 is not bad, but JDK7 seems right now to be a
>>> heavy regression... FWIW for such a simple test. For one thing, these
>>> core-boot classes all come off the CDS file so their classloading
>>> effort is relatively very small, and the delta will certainly be much
>>> smaller for even the smallest real-world app.
>>
>> Right. -verbose:class prints out all loaded classes regardless of coming
>> from CDS archive or not. The number of loaded classes is one
>> metric to the startup while class loading time + clinit time are other
>> important metrics. So these loaded classes has small impact
>> to the startup time especially with CDS is enabled.
>>
>> Mandy
>>
>>> A+
>>> Osvaldo
>>>
>>> 2010/7/30 Mandy Chung <mandy.chung at oracle.com>:
>>>>
>>>> Yongqiang Yang wrote:
>>>>>
>>>>> hi,
>>>>>
>>>>> I just type command "java" under openjdk1.6, then the jvm will load
>>>>> 308 classes, including java/launcher/LauncherHelp,
>>>>> java/util/ResourceBundle,
>>>>> java/util/Currency,
>>>>> java/util/Locale,
>>>>> java/net/URL
>>>>>
>>>>> When I use jdk1.5, the jvm just load about 180 classes, not
>>>>> including the classes above.
>>>>>
>>>>> Could someone figure out something wrong?
>>>>
>>>> New features and bug fixes in a new release could lead to more classes
>>>> get
>>>> loaded at startup. We have done some work to lazily load classes if
>>>> appropriate (see CR 6798873: Reduce the number of classes loaded and
>>>> class
>>>> dependencies).
>>>>
>>>> Mandy
>>>>
>>>>
>>
>
>
Is the jdk7 here an OpenJDK build or an Oracle-provided binary?
There's likely to be a difference between the two, due to the
replacement of proprietary classes (e.g. Pisces renderer, lcms &
freetype code in OpenJDK which isn't used by the proprietary version).
--
Andrew :-)
Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)
Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8
More information about the core-libs-dev
mailing list