You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by AIvan <iv...@yahoo.com> on 2006/11/13 17:23:18 UTC

memory issues

I create DOM objects in my framework as:
public class MyRect extends SVGOMRectElement {
  ....
  public MyRect(JSVGCanvas svgCanvas) {
    super(svgCanvas.svgNS, svgCanvas.document);
    ....
  }
  ....
}
Then I create instance and append it to i.e. root element:
MyRect r = new MyRect(svgCanvas);
myCanvas.document.getRootElement().appendChild(r);

1) Is this the right way to create objects?
2) I create large number of DOM objects (more than i.e. 5000 but not as
simple as the above). I used several profilers to track memory allocation.
(Suppose these 5000 objects occupy about 30MB of heap size). More than 90%
are primitive data types: float[], int[], char[], etc... - data types which
I don't use so much in the framework. So my guess is that some of them are
used by parent Batik classes. Am I right? 
3) In simple test I made, I created 5000 rectangles using the above class.
Then in second test I used document.createElement("rect")  method to create
same number of rectangles. Second test showed 8MB less occupation of memory.
Should I use document.createElement to create elements instead of extending
SVGOM classes?

Thanks, 
Ivan

-- 
View this message in context: http://www.nabble.com/memory-issues-tf2623386.html#a7320086
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org