jvm garbage collector (Epsilon)


jvm garbage collector (Epsilon)

 

Epsilon does not reclaim memory, only responsible for heap management and layout, object allocation, and collaboration with interpreters, compilers, and monitoring subsystems;

epsilon is suitable for applications that have a short running time and can be exited before the memory is exhausted

 

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

Related parameters:

 

-XX: + UnlockExperimentalVMOptions: The garbage collector Epsilon is still in the experimental stage, you need to use this parameter to use Epsilon

-XX: + UseEpsilonGC: use the garbage collector Epsilon

 

 

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

Examples

 

public class Test {

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

        System.gc();
    }
}

 

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

Virtual machine parameters

 

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

 

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

Console output

 

[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

 

 

Published 387 original articles · Like 98 · Visits 30,000+

Guess you like

Origin blog.csdn.net/weixin_43931625/article/details/105184329