当前位置:网站首页>JVM 类加载机制
JVM 类加载机制
2022-07-07 17:52:00 【whiteye太白】
类加载机制
加载 —> 连接(验证 -> 准备 -> 解析)—> 初始化 —> 使用 —> 卸载
1. 加载
- 通过全类名获取定义此类的二进制字节流
- 将字节流所代表的静态存储结构转换为方法区的运行时数据结构
- 在内存中生成一个代表该类的 Class 对象,作为方法区这些数据的访问入口
2. 验证
- class文件格式验证:class文件规范
- 元数据验证:语义分析,是否符合java语言规范
- 字节码验证:操作指令合法
- 符号引用验证:确保解析动作正确执行
3. 准备
为类的静态变量分配内存,并将其初始化为默认值。
(不是赋初值,final 关键字修饰的静态常量则直接赋初值,加载到方法区运行时常量池。)
4. 解析
将常量池内的符号引用替换为直接引用的过程。
5.初始化
为类的静态变量赋予正确的初始值,JVM负责对类进行初始化,主要对类变量进行初始化。
初始化类触发: new实例对象、访问类的静态变量、调用类的静态方法、反射调用类、子类需初始化时先初始化父类(接口同样)、mian方法类。
6. 卸载
- 该类的所有的实例对象都已被 GC,也就是说堆不存在该类的实例对象。
- 该类没有在任何地方被引用。
- 该类的类加载器的实例已被 GC。
边栏推荐
- 2022年投资哪个理财产品收益高?
- IP 工具类
- Kirin Xin'an won the bid for the new generation dispatching project of State Grid!
- Implement secondary index with Gaussian redis
- Install mysql8 for Linux X ultra detailed graphic tutorial
- 杰理之关于 TWS 配对方式配置【篇】
- ASP. Net gymnasium integrated member management system source code, free sharing
- The DBSCAN function of FPC package of R language performs density clustering analysis on data, checks the clustering labels of all samples, and the table function calculates the two-dimensional contin
- Matplotlib drawing 3D graphics
- L1-027 rental (Lua)
猜你喜欢

mock.js从对象数组中任选数据返回一个数组

Research and practice of super-resolution technology in the field of real-time audio and video

Jürgen Schmidhuber回顾LSTM论文等发表25周年:Long Short-Term Memory. All computable metaverses. Hierarchical reinforcement learning (RL). Meta-RL. Abstractions in generative adversarial RL. Soccer learn

2022.07.04

Responsibility chain model - unity

PMP每日一练 | 考试不迷路-7.7

Welcome to the markdown editor

Simulate the implementation of string class

谷歌seo外链Backlinks研究工具推荐

8 CAS
随机推荐
R language ggplot2 visualization: use the ggqqplot function of ggpubr package to visualize the QQ graph (Quantitative quantitative plot)
el-upload上传组件的动态添加;el-upload动态上传文件;el-upload区分文件是哪个组件上传的。
Netease Yunxin participated in the preparation of the standard "real time audio and video service (RTC) basic capability requirements and evaluation methods" issued by the Chinese Academy of Communica
注解。。。
Flink并行度和Slot详解
关于自身的一些安排
8 CAS
LeetCode 515(C#)
现在股票开户可以直接在网上开吗?安全吗。
AD域组策略管理
一锅乱炖,npm、yarn cnpm常用命令合集
[RT thread env tool installation]
转置卷积理论解释(输入输出大小分析)
Experiment 1 of Compilation Principle: automatic implementation of lexical analyzer (Lex lexical analysis)
Interpretation of transpose convolution theory (input-output size analysis)
ASP. Net kindergarten chain management system source code
R language ggplot2 visualization: use the ggstripchart function of ggpubr package to visualize the dot strip plot, set the position parameter, and configure the separation degree of different grouped
项目经理『面试八问』,看了等于会了
九章云极DataCanvas公司获评36氪「最受投资人关注的硬核科技企业」
9 原子操作类之18罗汉增强