Enter
"Tools"-"Plugins" of the plugin management of jvisualvm
Online installation
Modify the URL address in "Settings" to the address that corresponds to our JDK version we found on github just now
After the modification is successful, the available plug-ins can be refreshed
Offline installation
Install the downloaded plugin
Download link: find the corresponding jdk version and install the corresponding version of gc
https://visualvm.github.io/pluginscenters.html
Install the VisualGC plugin
![](https://img-blog.csdnimg.cn/20210217175414834.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L25tamhlaGU=,size_16,color_FFFFFF,t_70)
You can see VisualGC
practice:
public class OOMTest {
byte[] b = new byte[1024 * 10];
public static void main(String[] args) throws InterruptedException {
ArrayList<OOMTest> all = new ArrayList<>();
while (true) {
all.add(new OOMTest());
Thread.sleep(10);
}
}
}
You can see that gc is happening all the time