<P><FONT FACE="Monospace,Courier">Well, I tested it using both OptimizeIt and JProfiler, and got the same results.</FONT></P><P><FONT FACE="Monospace,Courier">You're right when saying that incresing the capacity will leave more memory used. But let's do a simple computation.</FONT></P><P><FONT FACE="Monospace,Courier">An object overhead is about 34 bytes (depending on the JVM). A typical Element is made of severals objects: lists, strings, ... At least, I think that an object is made with a minimum of 8 objects, and I do not take care of children. 8*34=272, while an object reference is 4 bytes, which is 68 times smaller!</FONT></P><P><FONT FACE="Monospace,Courier">Being objective, your array size can grow without affecting the global memory consumption. Currently the pb exists because both the INTIAL_ARRAY_SIZE and the way the new size is computed are 'hard coded' and cannot be changed. Maybe publishing these data as static members, and letting a particular implementation change the constants will solve things.</FONT></P><P><FONT FACE="Monospace,Courier">Another idea is to have methods that directly add an array of children to an element, in one shot, thus allocating the array with the exact size. Then, in SaxBuilder or XMLS Input stream, we can manage a cache that collects the children and add all of them when the parent element is completly read. This will save both time (no reallocation during the construction process) and also memory because the arrays will be sized exactly.</FONT></P><P><FONT FACE="Monospace,Courier">Phil.</FONT></P><P><FONT FACE="Monospace,Courier">>>>Alex Wrote:</FONT></P><P><FONT FACE="Monospace,Courier">I'm not sure how much I trust OptimizeIt (etc) anymore now that HotSpot<BR>has come along. It's great for finding possible problem areas but not<BR>very good at giving accurate timings - i.e. I take its findings with a<BR>large grain of salt. Doing further tests is the right way to go.<BR></FONT><BR><FONT FACE="Monospace,Courier">Also, if we increase the capacity, that might make parsing faster but<BR>leave around more unused memory afterwards, right?<BR></FONT></P>