How can I see which garbage collector java is using

前端 未结 7 519
离开以前
离开以前 2020-12-10 03:26

The Java Virtual Machine supports several garbage collection strategies.

This article explains them.

Now I am wondering which (automatically selected) strat

7条回答
  •  一向
    一向 (楼主)
    2020-12-10 04:16

    Looks like, we have more convenient way to define the version of GC at runtime. Always use tools, my suggestion. To define GC version we need two tools that come with JVM (placed in your jdk/bin directory):

    1. VisualVM - start it and try to profile some process (for example you can profile VisualVM itself). Your profile will show you a PID of process (see the green rectangles at a screenshot).
    2. jMap - start this tool with -heap options and find a string dedicated to a Garbage Collector type (see a pink line at a screenshot)

提交回复
热议问题