I'm on XStream 1.4.7 (I'll get myself current in a moment)

I'm looking at line 67 of the AbstractReferenceUnmarshaller where it's putting 
the integer `10` in as a value for the reference-key 
".../myModelMatrixClass/widthOfMatrix". The field corresponding to that path is 
an 'int'.

the myModelMatrix type does use a custom converter which extends the 
ReflectionConverter, but it uses the stock `unmarshalField` method to 
unmarshall that field, which in turn is hitting the 
'abstractReferenceUnmarshaller' to unmarshall the '10' value at the element 
<widthOfMatrix>10</widthOfMatrix>

I hope I'm describing this accurately. I could start putting together an SSCCE 
if it would help.

-Geoff

From: J?rg Schaible<mailto:joerg.schai...@gmx.de>
Sent: ?Tuesday?, ?April? ?21?, ?2015 ?2?:?57? ?PM
To: user@xstream.codehaus.org<mailto:user@xstream.codehaus.org>

Hi Geoff,

Geoff Groos wrote:

> Hey guys,
>
> Deserialization of our model (using XStream) currently requires upwards of
> 500mb of memory. I've been tasked with fixing this since, in the worst
> case, our model is a matrix with an upper bound of 10,000 rows and 1,000
> columns (10mb big).
>
> Looking at our deserialization process under the profiler, I noticed that
> XStream's xpath map was consuming upwards of 95% of that space. Digging in
> a little deeper, I noticed the XPath map keeping paths to Booleans and
> Integers.
>
> What's the purpose of keeping an XPath entry to an instance of an
> immutable type?
>
> In other words, If I had
>
> class XPathAnnoyer{
>     public Integer x; //using Object Integer, an immutable type.
>     public Integer y;
> }
>
> Integer intInstance = new Integer(20);
> XPathAnnoyer instance = new XPathAnnoyer();
> instance.x = intInstance;
> instance.y = intInstance;
>
> String result = xstream.serialize(instance);
>
> Result would be
> <XPathAnnoyer>
>     <x>20</x>
>     <y>20</y>
> </XPathAnnoyer>
>
> and the xpath map will contain the (completely useless entry)
> "Integer@ABC123" -> "root/dotdotdot/XPathAnnoyer/x"
>
> So when would that entry ever get used? Why bother keeping it?
>
> My argument against keeping it is that I'm hoping I can get my memory
> profile down significantly.
>
> Let me know if my understanding of this issue is not correct, or if
> there's some obvious case I'm overlooking.

Which xpath map you're talking about and which XStream version? XStream
keeps the references in the AbstractReferenceMarshaller.references and that
collection does not contain references to immutable types.

Cheers,
J?rg


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to