jvm的小练习

代码如下:

    public static void main(String[] args) {
       byte[] array= new byte[1024*1024];
       array=new byte[1024*1024];
       array=new byte[1024*1024];
       array=null;
        byte[] array2= new byte[2*1024*1024];



    }

  -XX:NewSize=5242880 -XX:MaxNewSize=5242880 -XX:InitialHeapSize=10485760 -XX:MaxHeapSize=10485760 -XX:SurvivorRatio=8 -XX:PretenureSizeThreshold=10485760 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:gc.log

 

Java HotSpot(TM) Client VM (25.65-b01) for windows-x86 JRE (1.8.0_65-b17), built on Oct  6 2015 17:26:22 by "java_re" with MS VC++ 10.0 (VS2010)
Memory: 4k page, physical 33310712k(23376192k free), swap 35407864k(23669908k free)
CommandLine flags: -XX:InitialHeapSize=10485760 -XX:MaxHeapSize=10485760 -XX:MaxNewSize=5242880 -XX:NewSize=5242880 -XX:OldPLABSize=16 -XX:PretenureSizeThreshold=10485760 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC -XX:-UseLargePagesIndividualAllocation -XX:+UseParNewGC 
上面是我们设置的参数
发生gc                         用时: 发生了一次parnewgc  年轻代可用空间4608kb,也就是eden+一个s的大小是4.5mb,gc 前是4018,gc后是这些存活下来511k
0.108: [GC (Allocation Failure) 0.108: [ParNew: 4018K->511K(4608K), 0.0017591 secs]
堆内存情况,9728K可用总空间按,年轻代+老年代
 4018K->1753K(9728K), 0.0018859 secs] 
 
 [Times: user=0.08 sys=0.00, real=0.00 secs] 
Heap
 par new generation   total 4608K, used 3701K [0x05a00000, 0x05f00000, 0x05f00000)
  eden space 4096K,  77% used [0x05a00000, 0x05d1d938, 0x05e00000)
  from space 512K,  99% used [0x05e80000, 0x05effc60, 0x05f00000)
  to   space 512K,   0% used [0x05e00000, 0x05e00000, 0x05e80000)
 concurrent mark-sweep generation total 5120K, used 1242K [0x05f00000, 0x06400000, 0x06400000)
 Metaspace       used 2091K, capacity 2280K, committed 2368K, reserved 4480K

  

posted @ 2021-08-03 15:29  三号小玩家  阅读(79)  评论(0编辑  收藏  举报
Title
三号小玩家的 Mail: 17612457115@163.com, 联系QQ: 1359720840 微信: QQ1359720840