Geoff Groos
2015-04-21 19:53:07 UTC
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)
â***@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.
thanks for any help,
-Geoff
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)
â***@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.
thanks for any help,
-Geoff