查看jvm gc日志(学习)

package com.cn.jvm;

/**
 * 描述:查看jvm gc
 *
 * jvm params:-verbose:gc -Xms20M -Xmx20M -Xmn10M -XX:SurvivorRatio=8 -XX:+PrintGCDetails
 * -verbose:gc -Xms20M -Xmx20M -Xmn10M -XX:SurvivorRatio=8 -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:G:\study_hard_myGIT\javaSE_test\src\com\cn\jvm\logs\gc.log
 * @author chen_q_i@163.com
 * 2017/11/7 : 15:44.
 * @version : 1.0
 */
public class TestAllLocation {

    private  static final int ONE_MB=1024*1024;
    
    public static void testAllLocatonMethod(){
        byte[] allLocation,allLocation1,allLocation2,allLocation3;
        allLocation= new byte[2*ONE_MB];
        allLocation1= new byte[2*ONE_MB];
        allLocation2= new byte[2*ONE_MB];
        //GC
        allLocation3= new byte[4*ONE_MB];
    }
    
    public static void main(String[] args) {
        for (int i = 0; i <3 ; i++) {

            testAllLocatonMethod();
        }
    }
    
    
    
}

image.png
image.png

运行结果

image.png

《深入理解Java虚拟机JVM高级特性与最佳实践》67页测试例

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,859评论 18 139
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 172,982评论 25 708
  • 转自 www.jianshu.com/p/bd1bfc0c34b8 作为一个程序员,在找工作的过程中,都会遇到笔试...
    灬黑客灬阅读 4,428评论 1 118
  • 【绘画基础班-星奇-作业打卡】 【20160709·第16天】 20160709绘画作业: 【作业内容】 必做:波...
    星奇阅读 138评论 0 0
  • -1- “陈同学,你好。 我是别的院系的张曼曼。我想你并不了解我,但是我对你却很了解哦!从第一次在外展活动看到你,...
    秦苗条阅读 15,133评论 101 344