示例程序:
//-Xmx20m -Xmn20m -Xmn10m -XX:+PrintGCDetails
public class HelloGC02 {
public static void main(String[] args) {
}
}
GC日志:
Heap
PSYoungGen total 9216K, used 3483K [0x00000000ff600000, 0x0000000100000000, 0x0000000100000000)
eden space 8192K, 42% used [0x00000000ff600000,0x00000000ff966e58,0x00000000ffe00000)
from space 1024K, 0% used [0x00000000fff00000,0x00000000fff00000,0x0000000100000000)
to space 1024K, 0% used [0x00000000ffe00000,0x00000000ffe00000,0x00000000fff00000)
ParOldGen total 10240K, used 0K [0x00000000fec00000, 0x00000000ff600000, 0x00000000ff600000)
object space 10240K, 0% used [0x00000000fec00000,0x00000000fec00000,0x00000000ff600000)
Metaspace used 3182K, capacity 4496K, committed 4864K, reserved 1056768K
class space used 342K, capacity 388K, committed 512K, reserved 1048576K
问题:
通过以上GC日志,发现新生代占用了 【3483k】空间,这是为什么呢? 难道在类加载的时候,经过了一系列的初始化而占用的内存空间?