Kesavan T.S wrote:
> Hi,
> In our applications heap dump during OutOfMemory errors we consistently see
> the following JAXB related objects :
> Count Total-size Type Name
> -------------------------------------------------------------------------------
> 4,617,766 184,710,640 com/sun/msv/grammar/InterleaveExp
> 42 85,121,184 array of com/sun/msv/grammar/Expression
> 144,490 4,623,680 com/sun/msv/verifier/regexp/OptimizationTag
> 154,803 3,715,272 com/sun/msv/util/StringPair
> 154,679 3 ,712,296
> com/sun/msv/verifier/regexp/OptimizationTag$OwnerAndCont
I'd like to learn the schema you are using, so that we can put that into
2.0 unit test.
> Will using a single instance of JAXBContext and pooling Marshallers help to
> resolve this.
Definitely share the single JAXBContext instance please. Especially if
your schema is big, JAXBContext would be quite large, and it will take a
lot of time to create it.
JAXBContext is thread safe. You only need one instance in your whole
application.
Marshaller can be pooled and recycled, but that shouldn't impact the
memory foot print that much. Pooling of marshaller is something you
consider only when you are really performance sensitive.
> I would really appreciate if anyone can recommend how to resolve as we are
> forced to recycle our 24/7 application.
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com