zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    Hibernate-查询缓存
    Hibernate-二级缓存 sessionFactory
    Hibernate-二级缓存策略
    Hibernate-一级缓存session
    缓存和连接池的区别
    Hibernate-一对多的关系维护
    Hibernate-缓存
    Java基础-jdk动态代理与cglib动态代理区别
    Java基础-CGLIB动态代理
    Java基础-静态代理与动态代理比较
  • 原文地址:https://www.cnblogs.com/duanxz/p/2878857.html
Copyright © 2011-2022 走看看