[gclist] Garbage collection and XML

Greg Colvin gcolvin@us.oracle.com
Tue, 6 Mar 2001 18:04:03 -0700


From: Richard A. O'Keefe <ok@atlas.otago.ac.nz>
> I wrote:
>     I thought there _was_ a UniqueString class in Java, but when I
>     looked for it, I couldn't find one.
> 
> Hans Boehm replied:
>     Isn't java.lang.String.intern() what you want?
> 
> It is indeed the thing that I had vaguely remembered.
> 
> What I *wanted* was a UniqueString class, with a less space-hungry
> representation than Java's String class.  A Java String requires
> 1 or 2 words of per-object overhead
> +
> 4 instance variables (one word each)
> +
> 2 or 3 words of per-array overhead
> +
> storage for the string proper.
> 
> The overheads are pretty substantial.

If you care about overheads then you shouldn't be using java ;->