jvm 垃圾收集器(Epsilon)


jvm 垃圾收集器(Epsilon)

Epsilon不回收内存,只负责堆的管理与布局,对象的分配,与解释器、编译器、监控子系统的协作;

epsilon适合运行时间短、在内存耗尽前就可退出的应用程序

**************************

相关参数:

-XX:+UnlockExperimentalVMOptions:垃圾收集器Epsilon仍处于试验阶段,需使用此参数才可使用Epsilon

-XX:+UseEpsilonGC:使用垃圾收集器Epsilon

**************************

示例

public class Test {

    public static void main(String[] args){
        byte[] b=new byte[10];
        b=null;

        System.gc();
    }
}

**********************

虚拟机参数

-Xms20m -Xmx20m  -Xlog:gc* -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC

**********************

控制台输出

[0.007s][warning][gc] Consider enabling -XX:+AlwaysPreTouch to avoid memory commit hiccups
[0.024s][info   ][gc,heap,coops] Heap address: 0x00000000fec00000, size: 20 MB, Compressed Oops mode: 32-bit
[0.024s][info   ][gc           ] Non-resizeable heap; start/max: 20M
[0.024s][info   ][gc           ] Using TLAB allocation; max: 4096K
[0.024s][info   ][gc           ] Elastic TLABs enabled; elasticity: 1.10x
[0.024s][info   ][gc           ] Elastic TLABs decay enabled; decay time: 1000ms
[0.024s][info   ][gc           ] Using Epsilon
[0.097s][info   ][gc           ] Heap: 20480K reserved, 20480K (100.00%) committed, 1113K (5.44%) used
[0.098s][info   ][gc,metaspace ] Metaspace: 1032M reserved, 4864K (0.46%) committed, 366K (0.03%) used
[0.152s][info   ][gc           ] GC request for "System.gc()" is ignored  
                                 //忽略垃圾回收请求,不进行垃圾回收
[0.153s][info   ][gc,heap,exit ] Heap
[0.153s][info   ][gc,heap,exit ] Epsilon Heap
[0.153s][info   ][gc,heap,exit ] Allocation space:
[0.153s][info   ][gc,heap,exit ]  space 20480K,   9% used [0x00000000fec00000, 0x00000000fedcf4b0, 0x0000000100000000)
[0.153s][info   ][gc,heap,exit ]  Metaspace       used 717K, capacity 4534K, committed 4864K, reserved 1056768K
[0.153s][info   ][gc,heap,exit ]   class space    used 65K, capacity 403K, committed 512K, reserved 1048576K
[0.153s][info   ][gc           ] Heap: 20480K reserved, 20480K (100.00%) committed, 1853K (9.05%) used
[0.153s][info   ][gc,metaspace ] Metaspace: 1032M reserved, 4864K (0.46%) committed, 717K (0.07%) used
发布了387 篇原创文章 · 获赞 98 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/weixin_43931625/article/details/105184329
今日推荐