设置
Run => Edit Configurations => VM options
- 添加 -XX:+PrintGCDetails
运行程序后会在末尾打印GC信息
2019-11-02 13:07:47 INFO ShutdownHookManager:54 - Deleting directory C:\Users\MSI-PC\AppData\Local\Temp\spark-201c381b-dad9-43ae-8bfc-cb27de67010f Heap PSYoungGen total 87552K, used 64517K [0x000000076b780000, 0x0000000771800000, 0x00000007c0000000) eden space 78336K, 79% used [0x000000076b780000,0x000000076f407838,0x0000000770400000) from space 9216K, 27% used [0x0000000770d80000,0x0000000770ff9ed8,0x0000000771680000) to space 9728K, 0% used [0x0000000770400000,0x0000000770400000,0x0000000770d80000) ParOldGen total 109568K, used 10117K [0x00000006c2600000, 0x00000006c9100000, 0x000000076b780000) object space 109568K, 9% used [0x00000006c2600000,0x00000006c2fe1548,0x00000006c9100000) Metaspace used 41925K, capacity 42508K, committed 42712K, reserved 1085440K class space used 6126K, capacity 6259K, committed 6360K, reserved 1048576K Process finished with exit code 0
- PSYoungGen(Parallel Scavenge): Eden + FromSpace
- 完整的YoungGeneration: Eden+FromSpace+ToSpace
- ParOldGen(Par => Parameter, Parameter of Old Generation): GC 回收前后老年代的参数变化
- Metaspace: 元空间 (使用, 容量, 提交了多少, 保存了多少)
- Class space: 类空间 (同上)