Java垃圾回收过程
来源:互联网 发布:帝国时代2知乎 编辑:程序博客网 时间:2024/05/23 18:49
自从Java8发布以来,Hotspot JVM堆区就再也没有了Permanent Generation的传说,取而代之的是直接内存Metaspace(元空间)。但是,目前对于Java GC的描述文献大多还基于JDK7,前些天看到Oracle官网对于JDK7 垃圾回收的文章,觉得描述非常清晰明了,于是转载过来,本来想翻译来着,想了想,还是不要画蛇添足,就这样吧。
Now that you understand why the heap is separated into different generations, it is time to look at how exactly these spaces interact. The pictures that follow walks through the object allocation and aging process in the JVM.
First, any new objects are allocated to the Eden space. Both survivor spaces start out empty.
When the eden space fills up, a minor garbage collection is triggered.
Referenced objects are moved to the first survivor space. Unreferenced objects are deleted when the eden space is cleared.
At the next minor GC, the same thing happens for the Eden space. Unreferenced objects are deleted and referenced objects are moved to a survivor space. However, in this case, they are moved to the second survivor space (S1). In addition, objects from the last minor GC on the first survivor space (S0) have their age incremented and get moved to S1. Once all surviving objects have been moved to S1, both S0 and eden are cleared. Notice we now have differently aged object in the survivor space.
At the next minor GC, the same process repeats. However this time the survivor spaces switch. Referenced objects are moved to S0. Surviving objects are aged. Eden and S1 are cleared.
This slide demonstrates promotion. After a minor GC, when aged objects reach a certain age threshold (8 in this example) they are promoted from young generation to old generation.
As minor GCs continue to occure objects will continue to be promoted to the old generation space.
So that pretty much covers the entire process with the young generation. Eventually, a major GC will be performed on the old generation which cleans up and compacts that space.
以上内容均来自http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html
- Java垃圾回收过程
- Java虚拟机垃圾回收过程
- Java垃圾回收_过程观察
- Java JVM 垃圾回收(GC)过程
- 垃圾回收过程
- CMS垃圾回收过程
- Java垃圾回收
- java垃圾回收算法
- JAVA垃圾回收问题
- Java 垃圾回收
- JAVA垃圾回收
- Java中的垃圾回收
- Java垃圾回收器
- java垃圾回收机制
- java垃圾回收
- java 垃圾回收 算法
- java垃圾回收
- Java垃圾回收机制
- solr学习(2.1)-solr 4.7.2 环境搭建
- Nginx服务搭建负载均衡,反向代理,缓存加速,访问分布式文件系统高可用
- Python-Every-Day:0001——优惠券(coupon)
- 剑指offer:斐波那契数列
- 如何理解vue的slot
- Java垃圾回收过程
- [3]Python学习笔记---写一个Python程序把CSDN专栏的所有文章另存为本地网页
- ios中屏幕触摸和摇晃的方法
- ASCII码
- Python学习18_高级形态学处理
- 如何用ARKit将太阳系装进iPhone(二)
- MySQL创建存储过程
- 查看系统PCIe gen
- nodejs异常处理