Java class loading time

Source: Internet
Author: User
ArticleDirectory
  • Class loading time
Class Loading

It directly showsCodeIt should be classloader. getsystemclassloader (). loadclass ("com. My. Test. abcclass "). So it is often mentioned that the class loader classloader is specialized in class loading. Specifically, "loading a class" refers to loading a class. the binary data in the class file is read into the memory and placed in the method area, and a Java is created in the heap area. lang. class Object. Therefore, the final output of "loading" is a class object in the heap. Once it is generated, loading will be done. Here is another example -- Method

The PPT captured by Master Bi Xuan depicts the JVM memory layout. The book will show that class information, class field information, and method information are stored in the method area; in addition, I have heard a saying before: "heap (New Generation + Old Generation) is reserved for Java developers, rather than heap (persistent zone is the method zone) it is left for the JVM to use ". Let's look back at the above description -- "loading a class" refers to loading a class. the binary data in the class file is read into the memory and placed in the method area, and a Java is created in the heap area. lang. class Object, in other words, "class loading" isProgramA window for getting class-related definition information. This window is a class object, in the course of class loading, the structured class definition information of the method area is mapped to an object class object in the heap. Then, the programmer can get an instance of the class through this bridge, for example, call the newinstance () of the class ().

Class loading time

Currently, I understand that the loading time of a class is not controlled by programmers and is controlled by the JVM itself. Maybe it needs to consider some optimization strategies, such as the classes that the JVM thinks are likely to need in the future, JVM can be loaded in advance when idle, that is, the class object in the heap is prepared in advance. The latest time for class loading should be clear, which is equivalent to the class initialization time. Next we will talk about it during initialization.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.