当前位置:网站首页>对象内存布局
对象内存布局
2022-07-01 21:43:00 【键盘歌唱家】
一、简介
在HotSpot虚拟机里,对象在堆内存中的存储布局可以划分为三个部分:对象头(Header)、实例数据(Instance Data)和对齐填充(Padding)。其中对其填充是为了保证对象是8字节的倍数!
其中对象头可以再次进行细分,分为对象标记(Mark Word)
和类元信息(类型指针)
,对于数组对象来说对象头又会多一个Length
部分。在64位系统中,Mark Word占了8个字节,类型指针占了8个字节,一共是16个字节。
从openJDK的oop.hpp
源码中可以看到:_mark字段是mark word,_metadata是类指针klass pointer,对象头(object header)即是由这两个字段组成.
二、对象头之MarkWord
可以发现哈希码、GC标记,GC次数,同步锁标记,偏向锁持有者都在Mark Word
里面.
这些信息都是与对象自身定义无关的数据,所以Mar
边栏推荐
猜你喜欢
Yan Rong looks at how to formulate a multi cloud strategy in the era of hybrid cloud
[NOIP2013]积木大赛 [NOIP2018]道路铺设 贪心/差分
pytest合集(2)— pytest运行方式
js如何获取集合对象中某元素列表
【商业终端仿真解决方案】上海道宁为您带来Georgia介绍、试用、教程
Microsoft, Columbia University | Godel: large scale pre training of goal oriented dialogue
Talking from mlperf: how to lead the next wave of AI accelerator
详解LockSupport的使用
PMP与NPDP之间的区别是什么?
Flume interview questions
随机推荐
[noip2013] building block competition [noip2018] road laying greed / difference
Why does blocprovider feel similar to provider?
基础—io密集型计算和cpu密集型计算
Using closures to switch toggle by clicking a button
MQ learning notes
Several ways of writing main function in C
Make a three digit number of all daffodils "recommended collection"
vscode的使用
Show member variables and methods in classes in idea
【生态伙伴】鲲鹏系统工程师培训
String type conversion BigDecimal, date type
二叉树的基本操作
详解ThreadLocal
测试撤销1
PMP证书真的有用吗?
Burpsuite simple packet capturing tutorial [easy to understand]
Use of vscode
MySQL empties table data
js数组拼接的四种方法[通俗易懂]
名单揭晓 | 2021年度中国杰出知识产权服务团队