• GC之十:GC (Allocation Failure)


    1、[GC (Allocation Failure) AF

    见:http://stackoverflow.com/questions/28342736/java-gc-allocation-failure

    示例代码:

    package dxz.jvm.part3;
    
    import java.util.concurrent.TimeUnit;
    
    /**
     * @VM args:-verbose:gc -Xms20m -Xmx20m -Xmn10m -XX:SurvivorRatio=8
     * -XX:PretenureSizeThreshold=3145728
     * 3145728=3m,所以下面的4m直接分配到老年代中
    *
    @author lenovo * */ public class GCTest { private static final int _1MB = 1024 * 1024; public static void testPretenureSizeThreshold() { byte[] allocation; allocation = new byte[4 * _1MB]; } public static void main(String[] args) throws InterruptedException { TimeUnit.SECONDS.sleep(30); testPretenureSizeThreshold(); } }

    结果:

    [GC (Allocation Failure) [PSYoungGen: 8192K->1000K(9216K)] 8192K->2064K(19456K), 0.0141635 secs] [Times: user=0.05 sys=0.00, real=0.01 secs] 
    Heap
     PSYoungGen      total 9216K, used 7743K [0x00000000ff600000, 0x0000000100000000, 0x0000000100000000)
      eden space 8192K, 82% used [0x00000000ff600000,0x00000000ffc95e98,0x00000000ffe00000)
      from space 1024K, 97% used [0x00000000ffe00000,0x00000000ffefa020,0x00000000fff00000)
      to   space 1024K, 0% used [0x00000000fff00000,0x00000000fff00000,0x0000000100000000)
     ParOldGen       total 10240K, used 1064K [0x00000000fec00000, 0x00000000ff600000, 0x00000000ff600000)
      object space 10240K, 10% used [0x00000000fec00000,0x00000000fed0a020,0x00000000ff600000)
     Metaspace       used 8554K, capacity 8862K, committed 9088K, reserved 1056768K
      class space    used 1025K, capacity 1115K, committed 1152K, reserved 1048576K

  • 相关阅读:
    CF div2 332 A
    vector resize 错误用法
    linux命令之 chown
    dlmalloc 编译 链接
    C++ 类 访问限制
    C++ 编译多态 运行多态
    libevent 编译 Windows
    浮点数小记
    NYOJ 435 棋盘覆盖(二)
    HDU 3555 Bomb 简单数位DP
  • 原文地址:https://www.cnblogs.com/duanxz/p/2878857.html
Copyright © 2020-2023  润新知