Search code examples
javagarbage-collectionxstreampermgen

Xstream creating classes and causing painful permgen collections


I'm having an issue where classes generated by Xstreams xstream.fromXML(xmlString) method are causing our web container to undergo painful garbage collections from the permgen filling up. It caused one of our resin 3.2.1 servers to become unresponsive, forcing a restart.

I tried using different Xstream drivers such as jdom, dom4j, DomDriver, xpp, and jettison with no luck.

The classes generated have names like sun.reflect.GeneratedSerializationConstructorAccessor23

Anyone know if it is possible to avoid this or is this an unavoidable side effect of the current Xstream implementation (1.4.2)?

Thanks in advance.


Solution

  • The problem was that we are creating a new instance of XStream every request. It is designed to be multi-threaded and caches generated classes. Converting it to a static instance fixed it.