I am creating dynamic CXF clients in my application.
This is a snippet of client creation code:
JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
Client client = factory.createClient("wsdl/hello.wsdl");
Now that I am setting up a test application using these options
java -Djava.io.tmpdir=/tmp/cxf -XX:MetaspaceSize=12m -XX:MaxMetaspaceSize=24m -XX:MaxMetaspaceFreeRatio=80 -XX:MinMetaspaceFreeRatio=40 -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=sums=200 -XX:+ParallelRefProcEnabled -XX:+AggressiveOpts -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/hdump.hprof -XshowSettings -jar classloader-leak.jar
and to do client creation in a loop, I get java.lang.OutOfMemoryError: Metaspace exception. I do not know why classes / metaspace are not unloaded. If someone can help me here - this is my test project. Just create (mvn clean package) it and run it on the command line, just like me.
I am using JDK8u77.
bilak source
share