当前位置:网站首页>JVM memory model: class loading process
JVM memory model: class loading process
2022-07-22 16:30:00 【Twilight_ years】
The class loading subsystem is responsible for loading Class file ,class The file has a specific file ID at the beginning .
ClassLoader Only responsible for class Loading of files , As for whether it can run , from Execution Engine decision .
The loaded class information is stored in the method area .
ClassLoader Role
Equivalent to a courier role , hold class File loading to JVM Method area .
Class loading process :
load :
1、 Get the binary byte stream that defines the class through the fully qualified name of the class
2、 Convert the static storage structure represented by this byte stream into the method area runtime data structure
3、 Generate a representation of this class in memory Class object , As the access entry of various data in the method area
link :
verification :
The purpose is to ensure Class The byte stream of the file contains information that meets the requirements of the current virtual machine , Ensure the correctness of the loaded class .
It mainly includes four kinds of verification : File format validation , Metadata validation , Bytecode verification , Symbol reference validation .
Get ready :
* Class variables (static) Allocate memory and set the default initial value of the variable , That's zero .
* The preparation phase does not include final Embellished static, because final It will be allocated at compile time , The preparation phase explicitly initializes .
* Initialization is not assigned to instance variables in the preparation phase , Class variables are assigned in the method area , Instance variables are assigned to... Along with the object java In the pile .
analysis :
* The process of converting a symbolic reference in a constant pool to a direct reference .
* Parsing is often accompanied by JVM Execute after the initialization of the game .
* A symbolic reference is a set of symbols that describe the target of the reference . A direct reference is a pointer directly to the target 、 Relative offset or an indirect handle to the target .
* Parsing actions are mainly for classes or interfaces , Field , Class method , Interface method , Method type, etc .
* Corresponds to... In the constant pool constant_Class_info,constant_Fieldref_info,constant_Methodref_info etc. .
initialization :
* The initialization phase is the execution of class constructor methods <clinit>() The process of . This method does not need to define , yes javac The compiler automatically collects the assignment actions of all class variables in the class and the statements in the static code block .
* The instructions in the constructor method are executed in the order in which the statements appear in the source file .
*<clinit>() Constructors different from classes .
* If the class has a parent class ,JVM Will guarantee the subclass <clinit>() Before execution , Of the parent class <clinit>() Execution completed .
* The virtual machine must guarantee a class of <clinit>() Method is locked synchronously under multithreading .
边栏推荐
- 进程和线程面试问题
- Vulkan official example interpretation subchannel
- Android interview: 2022 please keep this experience of Netease Android development and Tiktok e-commerce Android engineers
- Figure calculation - figure introduction
- Thinking about the transformation between string and char[]
- 一个15年ABAP老兵的建议:了解这些基础知识,对ABAP开发有百利而无一害
- Mock simulates data and initiates get and post requests (nanny level tutorials are sure to succeed)
- Purchase instructions for pull-up device and waist cushion
- NFT 交易所合约开发教程(Solidity & Hardhat)
- 图计算-图简介
猜你喜欢
ftp服务器搭建部署与C#实现ftp文件的上传
Lecture 7 pipeline, environment variables and common commands
[unity project practice] game architecture
EasyCVR平台级联时,出现报错提示端口不可达是什么原因?
DOM style operation
交换机与路由器技术:标准ACL、扩展ACL和命名ACL
Distributed scheduling problem
Chant Developer Workbench 2022
Docker data management case - MySQL data persistence
Hybrid混合开发与JSBridge
随机推荐
正点原子Lora无线串口的透明传输点对点通信及其注意事项
Hybrid hybrid development and jsbridge
C语言 pthread_join()函数
2022 those "hidden rules" in the interview of testers, don't step on the pit
MP查询条件
NFT 多样化的发行方式
Purchase instructions for pull-up device and waist cushion
Memory management interview questions
EasyCVR平台如何实现无需鉴权即可接入特殊设备?
STM32 single channel and multi-channel sampling of non DMA polling ADC based on Hal Library
Elephant Swap的LaaS方案迅速崛起,构建全新DeFi2.0协议
Hybrid混合开发与JSBridge
Classic books of Orthodontics
[SSM]SSM整合③(接口测试)
数据平台数据管理实践
Data structure in redis (2): jump table
[unity project practice] game architecture
EasyCVR平台V2.5.0版本及以上如何配置WebRTC协议实现低延迟播放?
Trigger Basics (medium)
这个好用的办公网优化工具,官宣免费了