Hi.
We're using Jersey 2.16 with JDK 1.7.0_55-b13 64 bit and Tomcat 7.0.21 under Windows 7 to build a REST api.
Now, we're facing a problem with memory usage during load. We've created a TestNG testcase method, that
performs CRUD operations 10 times in a loop. That method is invoked 1000 times by 50 concurrent threads.
After approx. 30 minutes, the server gets slower and slower until it gets an OutOfMemoryException. We
created a ThreadDump with jvisualvm and used Eclipse Memory Analyzer to get to the root problem.
It seems that hk2's SystemDescriptor is eating memory like a boss :). Here's the output of the analyzer:
170.088 instances of "org.jvnet.hk2.internal.SystemDescriptor",
loaded by "org.apache.catalina.loader.WebappClassLoader @ 0xc026bd80"
occupy 625.581.408 (92,47%) bytes.
These instances are referenced from one instance of "org.jvnet.hk2.internal.ServiceLocatorImpl",
loaded by "org.apache.catalina.loader.WebappClassLoader @ 0xc026bd80"
We already found an old JIRA ticket regarding a SystemDescriptor memory leak:
https://java.net/jira/browse/HK2-205
that was fixed in 2.3.0.
So we switched to the latest hk2 version, 2.4.0-b16. But without any effect.
We're wondering what SystemDescriptor is used for and why it is eating so much memory.
Does anyone have deeper insights?
Thanks!
Veit