[EMAIL PROTECTED] wrote on 03/17/2005 02:41:00 AM: > Michael, > > > String.intern() always returns a unique string object, so you > > could override addSymbol like this: > > > > public String addSymbol(char[] buffer, int offset, int length) { > > return new String(buffer, offset, length).intern(); } > > > > and cache nothing in the table. This would be slower but > > you'd save memory which would have otherwise been used to > > create a new Entry and a new character array (that has the > > same contents as the string). The memory consumption of > > String.intern() is another story, but for Xerces to work > > correctly it can't be avoided. > > On the Java heap side, using a non-caching SymbolTable leads to only 700kB > of memory allocated at the end of parsing such an XML document instead of > the 20MB before. I do see a lot of Java GC going on due to the exhaustive > String creation. One step closer to a solution I guess... :-) > > How can I measure the size of the interned string table held privately by > the String class? Is this table kept in memory until the VM ends? Does it > also shrink or does it only grow?
I don't know, though I think the answer to all three will depend on which JRE you're using. > Ringo > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]