本文共 1743 字,大约阅读时间需要 5 分钟。
???????????????
1. ??????
?Java???????????????????????????
1.1 ???????
???????????????
new??????????????getInstance???????XXXFactory?????? Class?newInstance????JDK9??????????????????????????????? public? Constructor?newInstance(Xxxx)???????????????????????? ??clone()?????????????????????Cloneable????clone??? ?????????????Socket?????? ???? Objenesis? 1.2 ???????
??????????????
??? public class ObjectTest { public static void main(String[] args) { Object obj = new Object(); }} - main() ???????????????
- ??
new ?????? Object ? - ?? Object ??
init() ?? obj ????????????????????
1.3 ???????????????????
- ???????
new ?????????????????? Metaspace ?????????????????????????????????????????????? - ??????????????????????????
ClassLoader + ?? + ?? ? key ??????? .class ???????????? ClassNotFoundException?????????????????? Class ??? 1.4 ???????
- ???????????????????????
- ????????????????????4????
- ???????????????????
- ??????Bump The Point?
- ???????????????????????
- ???????????????????
- ??????????????????
- ?????????????????????????
1.5 ??????
- CAS + ?????????????
- ???????? TLAB?????
UseTLAB ???? - ? Eden ???????????
1.6 ?????????
??????????????????????????????
1.7 ????????
????????????GC????????????????????
1.8 ?? init ???????
- ??????????
- ????? / ???????
- ???????
2. ???????
2.1 ???
?????????????Mark Word???????
??????
- ????HashCode?
- GC???????????
- ?????
- ??????
- ????ID
- ?????
????
?????? InstanceKlass???????????
2.2 ????
- ?????????????????????
- ??????????
- ??
CompactFields ? true???????????????????
2.3 ????
?????????????????
2.4 ??????
3. ???????
JVM??????????????????????????
1. ????
???reference ?????????????????????????????
?????????????????
2. ????
????????????????????????????
????????????? reference ???
HotSpot ???????????
转载地址:http://epfc.baihongyu.com/