Affects PMD Version:
6.29.0
Description:
ClassTypeResolver#searchNodeNameForClass does many more ClassLoader.loadClass() calls than there are classes in the project. Because the looked up names do not exist, the calls go through all the classloaders in the hierarchy, and every classloader creates an entry for the name in its parallelLockMap.
In turn, JavaTypeDefinition#CLASS_EXACT_TYPE_DEF_CACHE holds references to the types that do exist in the project, which keep alive the classloaders of all the modules in the Maven reactor, along with their parallelLockMap.
Steps to reproduce:
- Set a conditional breakpoint in
ClassLoader#getClassLoadingLock with condition className.contains(".get")
- Start a debug configuration listening on port 5005
- Run
MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=localhost:5006" mvn pmd:pmd
Running PMD through: Maven
Affects PMD Version:
6.29.0
Description:
ClassTypeResolver#searchNodeNameForClassdoes many moreClassLoader.loadClass()calls than there are classes in the project. Because the looked up names do not exist, the calls go through all the classloaders in the hierarchy, and every classloader creates an entry for the name in itsparallelLockMap.In turn,
JavaTypeDefinition#CLASS_EXACT_TYPE_DEF_CACHEholds references to the types that do exist in the project, which keep alive the classloaders of all the modules in the Maven reactor, along with theirparallelLockMap.Steps to reproduce:
ClassLoader#getClassLoadingLockwith conditionclassName.contains(".get")MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=localhost:5006" mvn pmd:pmdRunning PMD through: Maven