You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Simon Laws <si...@googlemail.com> on 2011/02/17 17:48:04 UTC

Memory leaks around JAXB context

I've been looking at TUSCANY-3835 for a day or so. This is a bit of
therapeutic writing down of what I've found to see if I can make sense
of it. I've initially been looking at the 1.x code base but I expect
the similar things are true of the 2.x code base.

This started as I noticed that over restarts I was getting a large
number of GeneratedClassLoader instances hanging around. While this
doesn't seem to cause a serious leak the tenured space utilization
increases gradually and the number of loaded classes increases quite
quickly.

Tuning on the class loading/unloading I see this kind of thing (I'm
using the 1.x itest/wsdlgen/HttpTransportTestCase but with a local
change to repeated load/start/stop a node).

Firstly a whole stack of loaded classes for each restart as these are
the classes that are generated from the WSDL to populate the JAXB
context

[Loaded helloworld.jaxws.GetGreetings from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsResponse from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsDBean from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsDBeanResponse from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsByteArray from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsByteArrayResponse from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsException from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsExceptionResponse from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsBean from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsBeanResponse from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsBeanArray from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsBeanArrayResponse from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsBBean from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsBBeanResponse from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsCBean from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsCBeanResponse from __JVM_DefineClass__]
[Loaded yetanotherpackage.jaxws.HelloWorldExceptionBean$JaxbAccessorF_message
from __JVM_DefineClass__]
[Loaded yetanotherpackage.jaxws.HelloWorldExceptionBean$JaxbAccessorF_message
from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0 from
__JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return
from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0 from
__JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0 from
__JVM_DefineClass__]
[Loaded yetanotherpackage.DBean$JaxbAccessorM_getField1_setField1_java_lang_String
from __JVM_DefineClass__]
[Loaded yetanotherpackage.DBean$JaxbAccessorM_getField1_setField1_java_lang_String
from __JVM_DefineClass__]
[Loaded yetanotherpackage.DBean$JaxbAccessorM_getField2_setField2_java_lang_String
from __JVM_DefineClass__]
[Loaded yetanotherpackage.DBean$JaxbAccessorM_getField2_setField2_java_lang_String
from __JVM_DefineClass__]
[Loaded yetanotherpackage.DBean$JaxbAccessorM_getField3_setField3_anotherpackage_BBean
from __JVM_DefineClass__]
[Loaded anotherpackage.BBean$JaxbAccessorM_getField1_setField1_java_lang_String
from __JVM_DefineClass__]
[Loaded anotherpackage.BBean$JaxbAccessorM_getField1_setField1_java_lang_String
from __JVM_DefineClass__]
[Loaded anotherpackage.BBean$JaxbAccessorM_getField2_setField2_java_lang_String
from __JVM_DefineClass__]
[Loaded anotherpackage.BBean$JaxbAccessorM_getField2_setField2_java_lang_String
from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return
from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return
from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return
from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return
from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return
from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0 from
__JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0 from
__JVM_DefineClass__]
[Loaded helloworld.ABean$JaxbAccessorM_getField1_setField1_java_lang_String
from __JVM_DefineClass__]
[Loaded helloworld.ABean$JaxbAccessorM_getField1_setField1_java_lang_String
from __JVM_DefineClass__]
[Loaded helloworld.ABean$JaxbAccessorM_getField2_setField2_java_lang_String
from __JVM_DefineClass__]
[Loaded helloworld.ABean$JaxbAccessorM_getField2_setField2_java_lang_String
from __JVM_DefineClass__]
[Loaded helloworld.ABean$JaxbAccessorM_getField3_setField3_anotherpackage_BBean
from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return
from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0 from
__JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0 from
__JVM_DefineClass__]
[Loaded anotherpackage.CBean$JaxbAccessorM_getField1_setField1_java_lang_String
from __JVM_DefineClass__]
[Loaded anotherpackage.CBean$JaxbAccessorM_getField1_setField1_java_lang_String
from __JVM_DefineClass__]
[Loaded anotherpackage.CBean$JaxbAccessorM_getField2_setField2_java_lang_String
from __JVM_DefineClass__]
[Loaded anotherpackage.CBean$JaxbAccessorM_getField2_setField2_java_lang_String
from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return
from __JVM_DefineClass__]
[Loaded helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0 from
__JVM_DefineClass__]

Occasionally it unloads a load of the generated classes. For example,

[Unloading class helloworld.jaxws.GetGreetingsBBean]
[Unloading class helloworld.jaxws.GetGreetingsBean]
[Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsCBean]
[Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
[Unloading class
helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray]
[Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray]
[Unloading class
helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
[Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
[Unloading class
helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsException]
[Unloading class
helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsByteArray]
[Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsDBean]
[Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
[Unloading class
helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
[Unloading class
helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsDBean]
[Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsCBean]
[Unloading class
helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
[Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBean]
[Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
[Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
[Unloading class
helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
[Unloading class
helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsDBean]
[Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
[Unloading class helloworld.jaxws.GetGreetings]
[Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
[Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
[Unloading class helloworld.jaxws.GetGreetingsCBean]
[Unloading class
helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBean]
[Unloading class helloworld.jaxws.GetGreetingsDBean]
[Unloading class
helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsResponse]
[Unloading class helloworld.jaxws.GetGreetingsException]
[Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
[Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetings]
[Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray]
[Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetings]
[Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
[Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
[Unloading class
helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsCBean]
[Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsResponse]
[Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBean]
[Unloading class helloworld.jaxws.GetGreetingsResponse]
[Unloading class helloworld.jaxws.GetGreetingsResponse]
[Unloading class helloworld.jaxws.GetGreetingsException]
[Unloading class
helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
[Unloading class helloworld.jaxws.GetGreetingsDBean]
[Unloading class
helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
[Unloading class
helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
[Unloading class
helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsException]
[Unloading class helloworld.jaxws.GetGreetingsByteArray]
[Unloading class helloworld.jaxws.GetGreetingsDBean]
[Unloading class
helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetings]
[Unloading class helloworld.jaxws.GetGreetings]
[Unloading class
helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBBean]
[Unloading class helloworld.jaxws.GetGreetingsCBean]
[Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
[Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
[Unloading class
helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
[Unloading class
helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
[Unloading class helloworld.jaxws.GetGreetings]
[Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
[Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
[Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
[Unloading class
helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsException]
[Unloading class helloworld.jaxws.GetGreetingsResponse]
[Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
[Unloading class
helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsByteArray]
[Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsByteArray]
[Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
[Unloading class
helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
[Unloading class
helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
[Unloading class
helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
[Unloading class helloworld.jaxws.GetGreetingsCBean]
[Unloading class helloworld.jaxws.GetGreetingsBBean]
[Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
[Unloading class
helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsException]
[Unloading class helloworld.jaxws.GetGreetingsByteArray]
[Unloading class
helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
[Unloading class
helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsException]
[Unloading class helloworld.jaxws.GetGreetingsDBean]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray]
[Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray]
[Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
[Unloading class
helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
[Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
[Unloading class
helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
[Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsException]
[Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
[Unloading class
helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBBean]
[Unloading class
helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
[Unloading class helloworld.jaxws.GetGreetings]
[Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBean]
[Unloading class
helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsResponse]
[Unloading class helloworld.jaxws.GetGreetingsBBean]
[Unloading class
helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBean]
[Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
[Unloading class
helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
[Unloading class
helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray]
[Unloading class helloworld.jaxws.GetGreetingsException]
[Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsCBean]
[Unloading class helloworld.jaxws.GetGreetingsResponse]
[Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBBean]
[Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsCBean]
[Unloading class
helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
[Unloading class
helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetings]
[Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
[Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
[Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsResponse]
[Unloading class helloworld.jaxws.GetGreetingsBBean]
[Unloading class helloworld.jaxws.GetGreetingsDBean]
[Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetings]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
[Unloading class
helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray]
[Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
[Unloading class
helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBean]
[Unloading class helloworld.jaxws.GetGreetingsBBean]
[Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetings]
[Unloading class helloworld.jaxws.GetGreetingsResponse]
[Unloading class helloworld.jaxws.GetGreetingsByteArray]
[Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray]
[Unloading class helloworld.jaxws.GetGreetingsBBean]
[Unloading class helloworld.jaxws.GetGreetingsBean]
[Unloading class
helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
[Unloading class
helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
[Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsCBean]
[Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsByteArray]
[Unloading class
helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsByteArray]
[Unloading class
helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
[Unloading class
helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
[Unloading class
helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsByteArray]
[Unloading class helloworld.jaxws.GetGreetingsDBean]
[Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
[Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
[Unloading class helloworld.jaxws.GetGreetingsBeanArray]
[Unloading class
helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
[Unloading class helloworld.jaxws.GetGreetingsBean]
[Unloading class
helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
[Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
[Unloading class
helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]

It doesn't though seem to unload all the classes that it loads. Which
would explain why the loaded classes continue to rise during a run.

The unloading may be occasional due to the way that we cache JAXB
context. We have a structure that looks roughly like....

JAXBContextHelper
  public static final JAXBContextCache cache = new JAXBContextCache();

JAXBContextCache
  protected LRUCache<Object, JAXBContext> cache;

LRUCache
   public class LRUCache<K, V> extends LinkedHashMap<K, V> {

Now the LRU cache gets used to cache the following
   K = Array of generated class objects (for the created types)
   V = JAXBContext

I'm a little suprised that it doesn't always hit the cache as I'm just
running a very small scenario over and over again so I need to look at
whether the key lookup is working correctly. Having an array of
generated class objects doesn't strike me as leading to happiness by
anyhow. Can anyone comment on that.

Every now and again the LRU will ditch some entries and I guess that's
when things get unloaded. However I did find [1] which may explain why
some of the obejcts don't get unloaded. Anyone have experience of this
aspect of the JAXB context. I feel I could spend a lot of time trying
to work out what's going on in there.

[1] https://issues.apache.org/jira/browse/CXF-2939

Regards

Simon

-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Re: Memory leaks around JAXB context

Posted by Raymond Feng <en...@gmail.com>.
It was me who initially introduced the LRUCache which extends from LinkedHashMap [1]. It only keeps a limited number of entries and the eldest one will be removed if the ceiling is hit.

[1] http://download.oracle.com/javase/1.4.2/docs/api/java/util/LinkedHashMap.html

We also generate JAX-WS wrappers on the fly too.

On the surface, https://issues.apache.org/jira/browse/CXF-2939 probably explains what's happening.

Thanks,
Raymond
________________________________________________________________ 
Raymond Feng
rfeng@apache.org
Apache Tuscany PMC member and committer: tuscany.apache.org
Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
Personal Web Site: www.enjoyjava.com
________________________________________________________________

On Feb 17, 2011, at 8:48 AM, Simon Laws wrote:

> I've been looking at TUSCANY-3835 for a day or so. This is a bit of
> therapeutic writing down of what I've found to see if I can make sense
> of it. I've initially been looking at the 1.x code base but I expect
> the similar things are true of the 2.x code base.
> 
> This started as I noticed that over restarts I was getting a large
> number of GeneratedClassLoader instances hanging around. While this
> doesn't seem to cause a serious leak the tenured space utilization
> increases gradually and the number of loaded classes increases quite
> quickly.
> 
> Tuning on the class loading/unloading I see this kind of thing (I'm
> using the 1.x itest/wsdlgen/HttpTransportTestCase but with a local
> change to repeated load/start/stop a node).
> 
> Firstly a whole stack of loaded classes for each restart as these are
> the classes that are generated from the WSDL to populate the JAXB
> context
> 
> [Loaded helloworld.jaxws.GetGreetings from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsResponse from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsDBean from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsDBeanResponse from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsByteArray from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsByteArrayResponse from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsException from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsExceptionResponse from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsBean from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsBeanResponse from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsBeanArray from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsBeanArrayResponse from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsBBean from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsBBeanResponse from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsCBean from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsCBeanResponse from __JVM_DefineClass__]
> [Loaded yetanotherpackage.jaxws.HelloWorldExceptionBean$JaxbAccessorF_message
> from __JVM_DefineClass__]
> [Loaded yetanotherpackage.jaxws.HelloWorldExceptionBean$JaxbAccessorF_message
> from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0 from
> __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return
> from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0 from
> __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0 from
> __JVM_DefineClass__]
> [Loaded yetanotherpackage.DBean$JaxbAccessorM_getField1_setField1_java_lang_String
> from __JVM_DefineClass__]
> [Loaded yetanotherpackage.DBean$JaxbAccessorM_getField1_setField1_java_lang_String
> from __JVM_DefineClass__]
> [Loaded yetanotherpackage.DBean$JaxbAccessorM_getField2_setField2_java_lang_String
> from __JVM_DefineClass__]
> [Loaded yetanotherpackage.DBean$JaxbAccessorM_getField2_setField2_java_lang_String
> from __JVM_DefineClass__]
> [Loaded yetanotherpackage.DBean$JaxbAccessorM_getField3_setField3_anotherpackage_BBean
> from __JVM_DefineClass__]
> [Loaded anotherpackage.BBean$JaxbAccessorM_getField1_setField1_java_lang_String
> from __JVM_DefineClass__]
> [Loaded anotherpackage.BBean$JaxbAccessorM_getField1_setField1_java_lang_String
> from __JVM_DefineClass__]
> [Loaded anotherpackage.BBean$JaxbAccessorM_getField2_setField2_java_lang_String
> from __JVM_DefineClass__]
> [Loaded anotherpackage.BBean$JaxbAccessorM_getField2_setField2_java_lang_String
> from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return
> from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return
> from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return
> from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return
> from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return
> from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0 from
> __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0 from
> __JVM_DefineClass__]
> [Loaded helloworld.ABean$JaxbAccessorM_getField1_setField1_java_lang_String
> from __JVM_DefineClass__]
> [Loaded helloworld.ABean$JaxbAccessorM_getField1_setField1_java_lang_String
> from __JVM_DefineClass__]
> [Loaded helloworld.ABean$JaxbAccessorM_getField2_setField2_java_lang_String
> from __JVM_DefineClass__]
> [Loaded helloworld.ABean$JaxbAccessorM_getField2_setField2_java_lang_String
> from __JVM_DefineClass__]
> [Loaded helloworld.ABean$JaxbAccessorM_getField3_setField3_anotherpackage_BBean
> from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return
> from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0 from
> __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0 from
> __JVM_DefineClass__]
> [Loaded anotherpackage.CBean$JaxbAccessorM_getField1_setField1_java_lang_String
> from __JVM_DefineClass__]
> [Loaded anotherpackage.CBean$JaxbAccessorM_getField1_setField1_java_lang_String
> from __JVM_DefineClass__]
> [Loaded anotherpackage.CBean$JaxbAccessorM_getField2_setField2_java_lang_String
> from __JVM_DefineClass__]
> [Loaded anotherpackage.CBean$JaxbAccessorM_getField2_setField2_java_lang_String
> from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return
> from __JVM_DefineClass__]
> [Loaded helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0 from
> __JVM_DefineClass__]
> 
> Occasionally it unloads a load of the generated classes. For example,
> 
> [Unloading class helloworld.jaxws.GetGreetingsBBean]
> [Unloading class helloworld.jaxws.GetGreetingsBean]
> [Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsCBean]
> [Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
> [Unloading class
> helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray]
> [Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
> [Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsException]
> [Unloading class
> helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsDBean]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsDBean]
> [Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsCBean]
> [Unloading class
> helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
> [Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBean]
> [Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
> [Unloading class
> helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsDBean]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
> [Unloading class helloworld.jaxws.GetGreetings]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
> [Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
> [Unloading class helloworld.jaxws.GetGreetingsCBean]
> [Unloading class
> helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBean]
> [Unloading class helloworld.jaxws.GetGreetingsDBean]
> [Unloading class
> helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsResponse]
> [Unloading class helloworld.jaxws.GetGreetingsException]
> [Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
> [Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetings]
> [Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray]
> [Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetings]
> [Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
> [Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsCBean]
> [Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBean]
> [Unloading class helloworld.jaxws.GetGreetingsResponse]
> [Unloading class helloworld.jaxws.GetGreetingsResponse]
> [Unloading class helloworld.jaxws.GetGreetingsException]
> [Unloading class
> helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
> [Unloading class helloworld.jaxws.GetGreetingsDBean]
> [Unloading class
> helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
> [Unloading class
> helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsException]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray]
> [Unloading class helloworld.jaxws.GetGreetingsDBean]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetings]
> [Unloading class helloworld.jaxws.GetGreetings]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBBean]
> [Unloading class helloworld.jaxws.GetGreetingsCBean]
> [Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
> [Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetings]
> [Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
> [Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
> [Unloading class
> helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsException]
> [Unloading class helloworld.jaxws.GetGreetingsResponse]
> [Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray]
> [Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray]
> [Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
> [Unloading class
> helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
> [Unloading class helloworld.jaxws.GetGreetingsCBean]
> [Unloading class helloworld.jaxws.GetGreetingsBBean]
> [Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsException]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray]
> [Unloading class
> helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsException]
> [Unloading class helloworld.jaxws.GetGreetingsDBean]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray]
> [Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
> [Unloading class
> helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsException]
> [Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBBean]
> [Unloading class
> helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetings]
> [Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBean]
> [Unloading class
> helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsCBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBBean]
> [Unloading class
> helloworld.jaxws.GetGreetingsDBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBean]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
> [Unloading class
> helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray]
> [Unloading class helloworld.jaxws.GetGreetingsException]
> [Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsCBean]
> [Unloading class helloworld.jaxws.GetGreetingsResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBBean]
> [Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsCBean]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
> [Unloading class
> helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetings]
> [Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
> [Unloading class helloworld.jaxws.GetGreetingsExceptionResponse]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBBean]
> [Unloading class helloworld.jaxws.GetGreetingsDBean]
> [Unloading class helloworld.jaxws.GetGreetingsBBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetings]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
> [Unloading class
> helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray]
> [Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBean]
> [Unloading class helloworld.jaxws.GetGreetingsBBean]
> [Unloading class helloworld.jaxws.GetGreetingsDBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetings]
> [Unloading class helloworld.jaxws.GetGreetingsResponse]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray]
> [Unloading class helloworld.jaxws.GetGreetingsException$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray]
> [Unloading class helloworld.jaxws.GetGreetingsBBean]
> [Unloading class helloworld.jaxws.GetGreetingsBean]
> [Unloading class
> helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArrayResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsExceptionResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanArrayResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
> [Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsCBean]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray]
> [Unloading class
> helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsCBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBean$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray]
> [Unloading class
> helloworld.jaxws.GetGreetingsByteArrayResponse$JaxbAccessorF__return]
> [Unloading class
> helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
> [Unloading class
> helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsByteArray]
> [Unloading class helloworld.jaxws.GetGreetingsDBean]
> [Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetings$JaxbAccessorF_arg0]
> [Unloading class helloworld.jaxws.GetGreetingsBeanArray]
> [Unloading class
> helloworld.jaxws.GetGreetingsCBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsDBeanResponse]
> [Unloading class helloworld.jaxws.GetGreetingsBean]
> [Unloading class
> helloworld.jaxws.GetGreetingsBeanResponse$JaxbAccessorF__return]
> [Unloading class helloworld.jaxws.GetGreetingsByteArrayResponse]
> [Unloading class
> helloworld.jaxws.GetGreetingsBBeanResponse$JaxbAccessorF__return]
> 
> It doesn't though seem to unload all the classes that it loads. Which
> would explain why the loaded classes continue to rise during a run.
> 
> The unloading may be occasional due to the way that we cache JAXB
> context. We have a structure that looks roughly like....
> 
> JAXBContextHelper
>  public static final JAXBContextCache cache = new JAXBContextCache();
> 
> JAXBContextCache
>  protected LRUCache<Object, JAXBContext> cache;
> 
> LRUCache
>   public class LRUCache<K, V> extends LinkedHashMap<K, V> {
> 
> Now the LRU cache gets used to cache the following
>   K = Array of generated class objects (for the created types)
>   V = JAXBContext
> 
> I'm a little suprised that it doesn't always hit the cache as I'm just
> running a very small scenario over and over again so I need to look at
> whether the key lookup is working correctly. Having an array of
> generated class objects doesn't strike me as leading to happiness by
> anyhow. Can anyone comment on that.
> 
> Every now and again the LRU will ditch some entries and I guess that's
> when things get unloaded. However I did find [1] which may explain why
> some of the obejcts don't get unloaded. Anyone have experience of this
> aspect of the JAXB context. I feel I could spend a lot of time trying
> to work out what's going on in there.
> 
> [1] https://issues.apache.org/jira/browse/CXF-2939
> 
> Regards
> 
> Simon
> 
> -- 
> Apache Tuscany committer: tuscany.apache.org
> Co-author of a book about Tuscany and SCA: tuscanyinaction.com


Re: Memory leaks around JAXB context

Posted by Simon Nash <na...@apache.org>.
Simon Laws wrote:
> On Fri, Feb 18, 2011 at 1:30 PM, Simon Nash <na...@apache.org> wrote:
>> Simon Laws wrote:
>>> On Thu, Feb 17, 2011 at 6:39 PM, Scott Kurz <sc...@gmail.com> wrote:
>>>> Simon,
>>>>
>>>> The cache allows us to reuse the JAXBContext across repeated service
>>>> invocations.   The fact that you don't hit the cache again after a
>>>> restart shouldn't be surprising, as we'd typically use a different
>>>> Classloader with different Class objects, right?
>>>>
>>>> I haven't fully digested the JAXB issue in the CXF JIRA, so I'll just
>>>> leave it at that.....but thought I could help a bit by mentioning
>>>> that.
>>>>
>>>> Scott
>>>>
>>> Raymond/Scott, thanks for the responses. It's becoming a little
>>> clearer. So the cache is then targeted at improving performance across
>>> multiple calls through an interface and has no use across node
>>> restarts (because we rebuild the classes). In that case I would
>>> suggest clearing the cache at node stop however this probably would
>>> make matters worse in the multiple nodes in the same VM scenario
>>> because the cache is ultimately accessed via a static
>>> JAXBContextCache.
>>>
>>> Regards
>>>
>>> Simon
>>>
>> Perhaps a node that is stopping could discover whether there are any
>> other nodes still running in the same JVM and not clear the cache
>> in that case.
>>
>> This could be done by nodes registering with the static cache when
>> they are started and deregistering when they are stopped.
>>
>>  Simon
>>
> 
> Or maybe we should have a cache per node (maybe that could be done
> with the approach you're suggesting). No sure why the JAXBContextCache
> is static. It's maybe hard to get a node oriented object into the
> databinding.
> 
> Simon
> 
> 
If there are multiple nodes in the same JVM (and using the same classloader)
then it makes more sense to have a shared static cache because the same
classes can be used/shared by multiple nodes.

If the nodes are using different classloaders, a separate cache for each
node would make more sense because there's no possibility of sharing
cached classes between nodes.

   Simon


Re: Memory leaks around JAXB context

Posted by Raymond Feng <en...@gmail.com>.
Yeah, we should refactor it into the UtilityExtensionPoint so that the instance can be managed by the NodeFactory.

Raymond Feng
Sent from my iPhone

On Feb 18, 2011, at 5:35 AM, Simon Laws <si...@googlemail.com> wrote:

> On Fri, Feb 18, 2011 at 1:30 PM, Simon Nash <na...@apache.org> wrote:
>> Simon Laws wrote:
>>> 
>>> On Thu, Feb 17, 2011 at 6:39 PM, Scott Kurz <sc...@gmail.com> wrote:
>>>> 
>>>> Simon,
>>>> 
>>>> The cache allows us to reuse the JAXBContext across repeated service
>>>> invocations.   The fact that you don't hit the cache again after a
>>>> restart shouldn't be surprising, as we'd typically use a different
>>>> Classloader with different Class objects, right?
>>>> 
>>>> I haven't fully digested the JAXB issue in the CXF JIRA, so I'll just
>>>> leave it at that.....but thought I could help a bit by mentioning
>>>> that.
>>>> 
>>>> Scott
>>>> 
>>> 
>>> Raymond/Scott, thanks for the responses. It's becoming a little
>>> clearer. So the cache is then targeted at improving performance across
>>> multiple calls through an interface and has no use across node
>>> restarts (because we rebuild the classes). In that case I would
>>> suggest clearing the cache at node stop however this probably would
>>> make matters worse in the multiple nodes in the same VM scenario
>>> because the cache is ultimately accessed via a static
>>> JAXBContextCache.
>>> 
>>> Regards
>>> 
>>> Simon
>>> 
>> Perhaps a node that is stopping could discover whether there are any
>> other nodes still running in the same JVM and not clear the cache
>> in that case.
>> 
>> This could be done by nodes registering with the static cache when
>> they are started and deregistering when they are stopped.
>> 
>>  Simon
>> 
> 
> Or maybe we should have a cache per node (maybe that could be done
> with the approach you're suggesting). No sure why the JAXBContextCache
> is static. It's maybe hard to get a node oriented object into the
> databinding.
> 
> Simon
> 
> 
> -- 
> Apache Tuscany committer: tuscany.apache.org
> Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Re: Memory leaks around JAXB context

Posted by Simon Laws <si...@googlemail.com>.
On Fri, Feb 18, 2011 at 1:30 PM, Simon Nash <na...@apache.org> wrote:
> Simon Laws wrote:
>>
>> On Thu, Feb 17, 2011 at 6:39 PM, Scott Kurz <sc...@gmail.com> wrote:
>>>
>>> Simon,
>>>
>>> The cache allows us to reuse the JAXBContext across repeated service
>>> invocations.   The fact that you don't hit the cache again after a
>>> restart shouldn't be surprising, as we'd typically use a different
>>> Classloader with different Class objects, right?
>>>
>>> I haven't fully digested the JAXB issue in the CXF JIRA, so I'll just
>>> leave it at that.....but thought I could help a bit by mentioning
>>> that.
>>>
>>> Scott
>>>
>>
>> Raymond/Scott, thanks for the responses. It's becoming a little
>> clearer. So the cache is then targeted at improving performance across
>> multiple calls through an interface and has no use across node
>> restarts (because we rebuild the classes). In that case I would
>> suggest clearing the cache at node stop however this probably would
>> make matters worse in the multiple nodes in the same VM scenario
>> because the cache is ultimately accessed via a static
>> JAXBContextCache.
>>
>> Regards
>>
>> Simon
>>
> Perhaps a node that is stopping could discover whether there are any
> other nodes still running in the same JVM and not clear the cache
> in that case.
>
> This could be done by nodes registering with the static cache when
> they are started and deregistering when they are stopped.
>
>  Simon
>

Or maybe we should have a cache per node (maybe that could be done
with the approach you're suggesting). No sure why the JAXBContextCache
is static. It's maybe hard to get a node oriented object into the
databinding.

Simon


-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Re: Memory leaks around JAXB context

Posted by Simon Nash <na...@apache.org>.
Simon Laws wrote:
> On Thu, Feb 17, 2011 at 6:39 PM, Scott Kurz <sc...@gmail.com> wrote:
>> Simon,
>>
>> The cache allows us to reuse the JAXBContext across repeated service
>> invocations.   The fact that you don't hit the cache again after a
>> restart shouldn't be surprising, as we'd typically use a different
>> Classloader with different Class objects, right?
>>
>> I haven't fully digested the JAXB issue in the CXF JIRA, so I'll just
>> leave it at that.....but thought I could help a bit by mentioning
>> that.
>>
>> Scott
>>
> 
> Raymond/Scott, thanks for the responses. It's becoming a little
> clearer. So the cache is then targeted at improving performance across
> multiple calls through an interface and has no use across node
> restarts (because we rebuild the classes). In that case I would
> suggest clearing the cache at node stop however this probably would
> make matters worse in the multiple nodes in the same VM scenario
> because the cache is ultimately accessed via a static
> JAXBContextCache.
> 
> Regards
> 
> Simon
> 
Perhaps a node that is stopping could discover whether there are any
other nodes still running in the same JVM and not clear the cache
in that case.

This could be done by nodes registering with the static cache when
they are started and deregistering when they are stopped.

   Simon

Re: Memory leaks around JAXB context

Posted by Simon Laws <si...@googlemail.com>.
On Thu, Feb 17, 2011 at 6:39 PM, Scott Kurz <sc...@gmail.com> wrote:
> Simon,
>
> The cache allows us to reuse the JAXBContext across repeated service
> invocations.   The fact that you don't hit the cache again after a
> restart shouldn't be surprising, as we'd typically use a different
> Classloader with different Class objects, right?
>
> I haven't fully digested the JAXB issue in the CXF JIRA, so I'll just
> leave it at that.....but thought I could help a bit by mentioning
> that.
>
> Scott
>

Raymond/Scott, thanks for the responses. It's becoming a little
clearer. So the cache is then targeted at improving performance across
multiple calls through an interface and has no use across node
restarts (because we rebuild the classes). In that case I would
suggest clearing the cache at node stop however this probably would
make matters worse in the multiple nodes in the same VM scenario
because the cache is ultimately accessed via a static
JAXBContextCache.

Regards

Simon

-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Re: Memory leaks around JAXB context

Posted by Scott Kurz <sc...@gmail.com>.
Simon,

The cache allows us to reuse the JAXBContext across repeated service
invocations.   The fact that you don't hit the cache again after a
restart shouldn't be surprising, as we'd typically use a different
Classloader with different Class objects, right?

I haven't fully digested the JAXB issue in the CXF JIRA, so I'll just
leave it at that.....but thought I could help a bit by mentioning
that.

Scott