You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Albrecht Militzer <al...@mms-dresden.de> on 2009/02/23 10:35:40 UTC

OutOfMemoryError receiving Soap Responses using Axis2 and XMLBeans

Hello,

 

I use XMLBeans with Axis2 to make webservice-calls. The latest version of
Axis2 uses XMLBeans 2.3.0 under the hood, so I am using that.

 

Occasionally I get OutOfMemoryErrors. They happen across different services
with different schemas. Sometimes it is an order search that returns 2.5 MB
of XML, sometimes it is a simple call to a content management system for
some I18N text for a GUI label.

 

I examined my memory dumps with IBMs Memory Analyzer.  I found a common
pattern. There is an almost infinite chain of
org.apache.xmlbeans.impl.store.Xobj$ElementXobj objects. One of these
objects references another of the same type and so on and on. I do not know
how long this chain is because it is too long to expand it in the Analyzer's
object tree. However, the Memory Analyzer tells me that this chain occupies
588 MB of memory. I consider this a lot even for 2.5 MB of XML. What it
unfortunately does not tell me is the name of the variable that holds the
reference from one element to the next. 

 

One more thing: Sometimes the root of the object tree is a
java.util.HashMap$Entry. (Before you ask, the Analyzer does not tell me the
actual contents of the objects, just the reference graph.) Looking for
reasons why such an object is the root, I found the following line in the
changelog for XMLBeans 2.4:

 

Replace static HashMaps with WeakHashMaps

 

Could this help me? If so, is there anyone here using Axis2 with XMLBeans
2.4.0?

 

I attached a screenshot of one of my memory dumps, but I do not know if the
mailing list allows this.

 

Thanks in advance for any help

 

Bye

 

Albrecht

 

 


RE: OutOfMemoryError receiving Soap Responses using Axis2 and XMLBeans

Posted by Cezar Andrei <ce...@oracle.com>.
Hi,

 

I don't think the change is related to the problem you're describing, this fix is related to the compiled xpath/xquery cache. Can you try using only XMLBeans to parse that document and compare the memory usage?

 

All you need to do is: 

XmlObject xo = XmlObject.Factory.parse(new File(name_of_3MB_file));

 

Cezar

 

________________________________

From: Albrecht Militzer [mailto:alm@mms-dresden.de] 
Sent: Monday, February 23, 2009 3:36 AM
To: user@xmlbeans.apache.org
Subject: OutOfMemoryError receiving Soap Responses using Axis2 and XMLBeans

 

Hello,

 

I use XMLBeans with Axis2 to make webservice-calls. The latest version of Axis2 uses XMLBeans 2.3.0 under the hood, so I am using that.

 

Occasionally I get OutOfMemoryErrors. They happen across different services with different schemas. Sometimes it is an order search that returns 2.5 MB of XML, sometimes it is a simple call to a content management system for some I18N text for a GUI label.

 

I examined my memory dumps with IBMs Memory Analyzer.  I found a common pattern. There is an almost infinite chain of org.apache.xmlbeans.impl.store.Xobj$ElementXobj objects. One of these objects references another of the same type and so on and on. I do not know how long this chain is because it is too long to expand it in the Analyzer's object tree. However, the Memory Analyzer tells me that this chain occupies 588 MB of memory. I consider this a lot even for 2.5 MB of XML. What it unfortunately does not tell me is the name of the variable that holds the reference from one element to the next. 

 

One more thing: Sometimes the root of the object tree is a java.util.HashMap$Entry. (Before you ask, the Analyzer does not tell me the actual contents of the objects, just the reference graph.) Looking for reasons why such an object is the root, I found the following line in the changelog for XMLBeans 2.4:

 

Replace static HashMaps with WeakHashMaps

 

Could this help me? If so, is there anyone here using Axis2 with XMLBeans 2.4.0?

 

I attached a screenshot of one of my memory dumps, but I do not know if the mailing list allows this.

 

Thanks in advance for any help

 

Bye

 

Albrecht