logo       

Related Msgs: audio.musicbrai...    enbd.general/20...    ietf.idr/2002-0...    java.ant-contri...    gnu.make.genera...    qplus.devel/200...    video.freevo.cv...    os.netbsd.ports...    yellowdog.gener...    xfree86.cvs/200...    search.nutch.us...    freedesktop.xse...    programming.swi...    capabilities.ge...    telephony.pbx.a...    mail.sylpheed.c...    db.firebase.por...    boot-loaders.u-...    recreation.radi...    netbsd.bugs/200...    web.zope.plone....    user-groups.lin...   

RE: OutOfMemory due to SymbolTable caching!: msg#00056

Subject: RE: OutOfMemory due to SymbolTable caching!
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?

Ringo



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo