title: stack overflow error converting object to xml using xstream
body: <p>The stack trace is as follows</p>
  
  <blockquote>
    <p>java.lang.OutOfMemoryError: Java heap space<br>
    at java.util.Arrays.copyOf(Arrays.java:3332)  at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137)  at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121)  at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:569)  at java.lang.StringBuffer.append(StringBuffer.java:369)  at java.io.StringWriter.write(StringWriter.java:94)  at com.thoughtworks.xstream.core.util.QuickWriter.flush(QuickWriter.java:73)  at com.thoughtworks.xstream.io.xml.PrettyPrintWriter.flush(PrettyPrintWriter.java:346)  at com.thoughtworks.xstream.XStream.toXML(XStream.java:1283)  at com.thoughtworks.xstream.XStream.toXML(XStream.java:1268)  at com.me.mypackage.mymethod.getObjectAsXml(myclass.java:142)  </p>
  </blockquote>
  
  <p>The above is the stack trace when I try to convert a object to xml using xstream.  I tried using Dom parser, Stax parse. Results are the same.
  My object has four fields int, float, reference to another class and list.
  Can someone explain why I get this error ?</p>