[gclist] Garbage collection and XML

Richard A. O'Keefe ok@atlas.otago.ac.nz
Wed, 7 Mar 2001 13:59:41 +1300 (NZDT)


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.