I don't think the discussion was finished when you did this, Glen.

Anyway, I've looked up our use of String.intern() in our sources and the
only use is with namespace URIs (see FOTreeBuilder). I believe the
intern() call there doesn't help a lot here concerning memory
consumption. If the XML parser creates a new String instance for every
SAX method call and for the namespace URI, then this is a thing we can't
change. We only evaluate the namespace URI to determine the routing of
the received elements. Since we implicitely know the namespace URI of
each element we don't need to save this information in our FO tree. It
doesn't take up any memory. We are only using the String instances given
to us by the XML parser. So I believe Nils proposed change doesn't have
any negative effects, especially since we don't seem to have pursued a
more widespread use of String.intern() back when it was discussed in
December 2003 (because it was seen as potentially problematic?). I hope
I interpreted this right.

On 26.06.2005 17:13:40 gmazza wrote:
> Author: gmazza
> Date: Sun Jun 26 08:13:38 2005
> New Revision: 201864
> 
> URL: http://svn.apache.org/viewcvs?rev=201864&view=rev
> Log:
> Switch to .equals() instead of == for String compares of namespaces.  Thanks 
> to Nils Meier for the suggestion.



Jeremias Maerki

Reply via email to