-XX:InitialHeapSize=5242880 -XX:MaxHeapSize=20971520 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseSerialGC MaxMemory=20316160bytes Free memory=5319728bytes Total memory=6094848bytes 我是分割线---------------------------------------- [GC (Allocation Failure) [DefNew: 756K->192K(1856K), 0.0032907 secs] 756K->516K(5952K), 0.0034158 secs] [Times: user=0.02 sys=0.00, real=0.00 secs] MaxMemory=20316160bytes Free memory=4448984bytes Total memory=6094848bytes Heap def new generation total 1856K, used 1333K [0x00000000fec00000, 0x00000000fee00000, 0x00000000ff2a0000) eden space 1664K, 68% used [0x00000000fec00000, 0x00000000fed1d438, 0x00000000feda0000) from space 192K, 100% used [0x00000000fedd0000, 0x00000000fee00000, 0x00000000fee00000) to space 192K, 0% used [0x00000000feda0000, 0x00000000feda0000, 0x00000000fedd0000) tenured generation total 4096K, used 324K [0x00000000ff2a0000, 0x00000000ff6a0000, 0x0000000100000000) the space 4096K, 7% used [0x00000000ff2a0000, 0x00000000ff2f1220, 0x00000000ff2f1400, 0x00000000ff6a0000) Metaspace used 2482K, capacity 4486K, committed 4864K, reserved 1056768K class space used 273K, capacity 386K, committed 512K, reserved 1048576K
publicclassNewSizeDemo{ publicstaticvoidmain(String[] args){ byte[] b = null; for (int i = 0; i < 10; i++) { b = newbyte[1*1024*1024]; //连续向系统请求10m } } }
[GC (Allocation Failure) [PSYoungGen: 510K->496K(1024K)] 510K->512K(19968K), 0.0433597 secs] [Times: user=0.00 sys=0.00, real=0.04 secs] Heap PSYoungGen total 1024K, used 708K [0x00000000ffe80000, 0x0000000100000000, 0x0000000100000000) eden space 512K, 41% used [0x00000000ffe80000,0x00000000ffeb50a0,0x00000000fff00000) from space 512K, 96% used [0x00000000fff00000,0x00000000fff7c020,0x00000000fff80000) to space 512K, 0% used [0x00000000fff80000,0x00000000fff80000,0x0000000100000000) ParOldGen total 18944K, used 10256K [0x00000000fec00000, 0x00000000ffe80000, 0x00000000ffe80000) object space 18944K, 54% used [0x00000000fec00000,0x00000000ff6040a0,0x00000000ffe80000) Metaspace used 2476K, capacity 4486K, committed 4864K, reserved 1056768K class space used 273K, capacity 386K, committed 512K, reserved 1048576K Java HotSpot(TM) 64-Bit Server VM warning: NewSize (1536k) is greater than the MaxNewSize (1024k). A new max generation size of 1536k will be used.
Heap PSYoungGen total 13824K, used 11526K [0x00000000ff100000, 0x0000000100000000, 0x0000000100000000) eden space 12288K, 93% used [0x00000000ff100000,0x00000000ffc41828,0x00000000ffd00000) from space 1536K, 0% used [0x00000000ffe80000,0x00000000ffe80000,0x0000000100000000) to space 1536K, 0% used [0x00000000ffd00000,0x00000000ffd00000,0x00000000ffe80000) ParOldGen total 5120K, used 0K [0x00000000fec00000, 0x00000000ff100000, 0x00000000ff100000) object space 5120K, 0% used [0x00000000fec00000,0x00000000fec00000,0x00000000ff100000) Metaspace used 2473K, capacity 4486K, committed 4864K, reserved 1056768K class space used 272K, capacity 386K, committed 512K, reserved 1048576K