With all the online tutorials showing the exact process you are describing,
- use visualvm
- WebappClassLoader search,
- find those whose "start" is false.
- Click "Show Nearest GC Root"
This can be confusing when it returns “No GC Root”.
But this is a good thing
These tutorials skipped the step, when viewing the WebappClassLoader list, click the "Calculate saved size" link on the right.

After a bit (depending on the total size of your heap), it will look something like this:

Lines with a stored value of 0 are also ClassLoaders, which have false status and no GC Root.
This means that they are ready for the next start of the GC, which is launched by the JVM.
Summary Despite the fact that “tomcat leak detection” shows a leak, if the saved size is 0, it has not leaked, it is just waiting for the GC to delete it.
Note: running GC in visualVM does not always delete it. Although it will be removed by the GC initiated by the JVM itself.
muttonUp
source share