jvm系列基础1:系统上线前预估系统的内存
分类:
文章
•
2025-03-31 17:25:51
jvm基础
- Garbage Collector
- GC turing
JVM GC的问题
- ThreadLocal有内存泄漏问题嘛?
- CMS的并发处理和并发可中断预处理
- 多大的对象会被扔到老年代
content
- what is garbage?
找到垃圾(没有引用指向的对象
)并回收
- how to find a grabage?
- reference count(引用计数)
- Root Searching
- which instances are roots?
- jvm stack
- native method stack
- run-time constant pool
- static references in method area
clazz?
GC Algorithms
- Mark-Sweep(标记清除)
- copying:把内存一分为二,只使用一半
- Mark-Compact:标记之后压缩,有利于新对象的存放
Garbage Collectors

- 垃圾回收器路线,是随着内存越来越大的过程演进
- 从分代算法演化到不分代算法
- 年轻代(
new
):使用copying
算法
-
eden(伊甸)
:存活得特别少
survivor1(幸存区)
survivor2(第二个幸存区)
- 老年代(
old
): 使用mark compact
算法
YGC与FGC
- YGC
- Young GC Minor GC
- Eden区不足
- FGC
- Full GC Major GC
- Old空间不足
- System.gc()
总结

年代划分

- Serial
- a
stop-the-world(stw)
,copying collecter which uses a single GC
- ParNew
- Parallel Scavenge
- Serial Old
- CMS