After digging through the code I see this issue is already handled by XStream by caching the generated classes in Sun14ReflectionProvider. Unfortunately we are creating a new instance every request. Our mistake.
Thanks for the help! -----Original Message----- From: Jörg Schaible [mailto:[email protected]] Sent: Friday, June 08, 2012 4:41 PM To: [email protected] Subject: [xstream-user] Re: Classes created on fromXML( ) causing permgen to fill up Hi Heath, Heath Gerhardt wrote: > Hi all, > > I've noticed that when xstream.fromXML(xmlString) is called a > sun.reflect.GeneratedSerializationConstructorAccessor class is created. Which XStream and Java version you're using? Please use the latest XStream release 1.4.2. > We are using xstream on a highish volume web service and these > generate classes are causing our permgen to fill up and trigger > painful garbage collections. Do you have a stack trace to the place where these objects are created? Since it is internal code of the Java runtime, I can only guess where such an object might be used. I am quite sure it is triggered by the converters based on reflection (mainly SerializableConverter and ReflectionConverter). Can you identify which creation of your objects triggers such an instance? > Is there a way to avoid this while continuing to use Xstream? Use custom converters instead of the ones based on reflection. Reflection provides a convenient way to marshal your objects, but those converters have a lot to do (not only reflection, they will also have to respect all your configuration for aliases, local converters and the like). With custom converters you define directly what is written and read. If you have the need to optimize for every millisecond, that's a way to go. http://xstream.codehaus.org/faq.html#Scalability_Performance > I've tried using different drivers (jdom, dom4j, DomDriver, xpp, > jettison) all with the same effect. Expected, since the driver only selects the XML parser, but has nothing to do with the functionality that recreates the objects. > Thanks in advance :) Hope this already helps a bit. - Jörg --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email ______________________________________________________________________ This message, including any attachments, is confidential and contains information intended only for the person(s) named above. Any other distribution, copying or disclosure is strictly prohibited. If you are not the intended recipient or have received this message in error, please notify us immediately by reply email and permanently delete the original transmission from all of your systems and hard drives, including any attachments, without making a copy.
