permgen, but Java VisualVM says “No GC root found”

删除回忆录丶 提交于 2019-12-03 13:51:02

With all the tutorials out on the web, showing the exact process you describe,

  1. use VisualVM,
  2. search for WebappClassLoader,
  3. look for ones with 'started' equal to false.
  4. Click 'Show nearest GC Root'

It can be confusing when it returns 'No GC Root'.

But this is a good thing

Those tutorials have missed a step, when viewing the list of WebappClassLoader click on the link 'Compute Retained Size' on the right hand side

After a bit(depending on the total size of your heap) this will show something like the following

The lines with a Retained value of 0 are also the ClassLoaders that have a status of false and no GC Root.

This just means they are ready for the next GC run that the JVM runs.

Summary : Even though 'tomcat leak Detection' shows the leak, if the retained size is 0, it hasn't leaked, its just waiting for GC to remove it.

Note : triggering a GC in visualVM will not always remove it. Although it will be removed by a GC triggered by the JVM itself.

Try closing the javaw.exe from the Task Manager processes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!