Today I launch another weapon in the ongoing war on Classloader Leaks: The classloader-leak-test-framework
. Admittedly, the framework itself is not new. The news is that in order to use it you no longer have to clone the Git repo, because it is now available as a Maven artifact through Maven Central.
If you want to confirm a suspected leak, just add
<dependency> <groupId>se.jiderhamn</groupId> <artifactId>classloader-leak-test-framework</artifactId> <version>1.0.0</version> <scope>test</scope> </dependency>
to your POM and create a test case that you believe would trigger the leak. (Make sure to check GitHub for the current version
.)
Heap dump when leak detected
Another improvement to the test framework that I have not previously announced, is that the framework can now automatically create a heap dump when a ClassLoader leak is detected. This makes it even easier to track down the cause of the leak and determine the required countermeasures. To activate this feature add @Leaks(dumpHeapOnError = true)
to your test method.
Test framework documentation
For further information on how to use the ClassLoader Leak test framework, see the projects space on GitHub.