記錄一個奇怪的問題

環境:jdk1.8

虛擬機參數:-verbose:gc -XX:+PrintGCDetails -Xmx20m -Xms20m -Xmn10m -XX:SurvivorRatio=8  -XX:+HeapDumpOnOutOfMemoryError

能夠看出,eden佔8M卻放不下6M數據,發生了一次Ygc.gc信息以下spa

[GC (Allocation Failure) [PSYoungGen: 6750K->936K(9216K)] 6750K->5040K(19456K), 0.0193742 secs] [Times: user=0.00 sys=0.02, real=0.03 secs] 
Heap
 PSYoungGen      total 9216K, used 3150K [0x00000000ff600000, 0x0000000100000000, 0x0000000100000000)
  eden space 8192K, 27% used [0x00000000ff600000,0x00000000ff8298d8,0x00000000ffe00000)
  from space 1024K, 91% used [0x00000000ffe00000,0x00000000ffeea020,0x00000000fff00000)
  to   space 1024K, 0% used [0x00000000fff00000,0x00000000fff00000,0x0000000100000000)
 ParOldGen       total 10240K, used 4104K [0x00000000fec00000, 0x00000000ff600000, 0x00000000ff600000)
  object space 10240K, 40% used [0x00000000fec00000,0x00000000ff002020,0x00000000ff600000)
 Metaspace       used 3497K, capacity 4498K, committed 4864K, reserved 1056768K
  class space    used 387K, capacity 390K, committed 512K, reserved 1048576K

新生代由原來的6750K 變成936K ,新生代總大小爲 9216K, 使用的堆空間由6750K 變成5040K ,總大小爲 19456(19M),耗時0.0193742秒code

原先的4m數據進入了老年代,1m在from區,1m在eden區blog

有些咱們看不到的東西佔了 6750-4*1024=2654K(2.5M)。Ygc後這些東西就釋放了ci

相關文章
相關標籤/搜索