I've discovered my application is heavily leaking memory. After taking heap dumps it appears Apache CXF (2.7.7) seems to be referencing lots of JaxWsServiceConfiguration (14000 in a day).
I'm not sure if I am using it correctly, whether I need to somehow release the client or there is a bug in CXF. Hopefully somebody can point me in the right direction here.
I am using a JaxWsProxyFactoryBean
injected into my service methods. The following line is called to create the client proxy (called for every request to the web service):
jaxWsProxyFactoryBean.create();
Eventually the service method finishes but it looks like the factory holds reference to the client proxy and therefore never GCs it.
I thought I could create a single static client and always use this but am a little nervous of this since it is not thread-safe in all circumstances: http://cxf.apache.org/faq.html#FAQ-AreJAX-WSclientproxiesthreadsafe?
Should I be doing this differently?