当前位置:网站首页>JVM memory and garbage collection-3-object instantiation and memory layout
JVM memory and garbage collection-3-object instantiation and memory layout
2022-07-08 01:58:00 【xcrj】
Object instantiation
Mind mapping
Example
Code
package xcrj;
/* * Object instantiation process * */
public class VMObjCreation {
public static void main(String[] args) {
Object obj = new Object();
}
}
command
# compile
javac -d D:\workspace\idea\JVMDemo\blog\target\classes\ -encoding UTF-8 VMObjCreation.java
# Decompile
javap -classpath D:\workspace\idea\JVMDemo\blog\target\classes\ -v xcrj.VMObjCreation
result - Decompile
Introduce
new #2
:#2
Symbol reference ; Judge whether the type is loaded , In the method area Class Object instances ;new
Open up storage space in the heap ;new
Member properties are initialized by defaultdup
:duplicate OS Top 1 individual byte, Re press into stack ;OS Store object references (int value ),OS The object reference in refers to the object entity in the heapinvokespecial #1
: Call the object constructor<init>
astore_1
: take OS The object reference at the top of the stack (int value ) Put it in LV Medium slot 1 The location of
Object memory layout
Object content
- Runtime metadata
- Type a pointer
- The instance data ( Parent instance data + Own instance data )
- Alignment filling
Mind mapping
Example
Code
package xcrj;
public class VMObjLayout {
private int age = 20;
private String name;
private Xcrj xcrj;
{
name = "xcrj";
}
public VMObjLayout() {
xcrj = new Xcrj();
}
}
class Xcrj {
}
command
# compile
javac -d D:\workspace\idea\JVMDemo\blog\target\classes\ -encoding UTF-8 VMObjLayout.java
# Decompile
javap -classpath D:\workspace\idea\JVMDemo\blog\target\classes\ -v xcrj.VMObjLayout
result - Decompile
Memory layout
- jdk7=+ String constant table and static variables are put in the heap
边栏推荐
- Codeforces Round #649 (Div. 2)——A. XXXXX
- Apache多个组件漏洞公开(CVE-2022-32533/CVE-2022-33980/CVE-2021-37839)
- C语言-Cmake-CMakeLists.txt教程
- Neural network and deep learning-5-perceptron-pytorch
- WPF custom realistic wind radar chart control
- Redux usage
- From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run
- Mysql database (2)
- cv2-drawline
- 剑指 Offer II 041. 滑动窗口的平均值
猜你喜欢
Introduction to ADB tools
From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run
Flutter 3.0框架下的小程序运行
A comprehensive and detailed explanation of static routing configuration, a quick start guide to static routing
ANSI / nema- mw- 1000-2020 magnetic iron wire standard Latest original
数据链路层及网络层协议要点
为什么更新了 DNS 记录不生效?
Sword finger offer II 041 Average value of sliding window
Js中forEach map无法跳出循环问题以及forEach会不会修改原数组
What are the types of system tests? Let me introduce them to you
随机推荐
Is it necessary for project managers to take NPDP? I'll tell you the answer
Can you write the software test questions?
Wechat applet uniapp page cannot jump: "navigateto:fail can not navigateto a tabbar page“
发现值守设备被攻击后分析思路
Remote Sensing投稿经验分享
Voice of users | winter goes and spring comes, waiting for flowers to bloom -- on gbase 8A learning comprehension
cv2-drawline
Apache multiple component vulnerability disclosure (cve-2022-32533/cve-2022-33980/cve-2021-37839)
【目标跟踪】|atom
Matlab r2021b installing libsvm
【目标跟踪】|DiMP: Learning Discriminative Model Prediction for Tracking
MySQL查询为什么没走索引?这篇文章带你全面解析
Is NPDP recognized in China? Look at it and you'll see!
2022国内十大工业级三维视觉引导企业一览
Codeforces Round #633 (Div. 2) B. Sorted Adjacent Differences
[SolidWorks] modify the drawing format
Partage d'expériences de contribution à distance
What are the types of system tests? Let me introduce them to you
Mysql database (2)
什么样的MES系统才是好系统