Parsing JSON

Kris Leite <[email protected]> Mon, 26 Nov 2007 11:45:20 -0800
Newsgroups gmane.comp.java.helma.general
Message-ID <[email protected]>
In case anybody is parsing a large number of JSON strings and found 
memory leakage issues you might consider replacing the Rhino Eval 
command with another JSON parser. 

I found that using the JSON parser in Helma, that uses the Rhino Eval 
command, to cause unexplained memory lost when using it to parse some 
75K+ small JSON strings.  This occurred with a single long running task 
that using JSON strings for passing data between a Helma server and 
another computer.  When I replaced the Rhino Eval with a javascript JSON 
parser, my memory lost disappeared.

I also found a couple changes to Property.java to be useful also:

1) Changed the line in 'setStringValue' from:

value = str:

to:

value = (str == null) ? null : new String(str);

2) Changed the line 'Property(String propname, Node node)' from:

this.propname = propname;

to:

this.propname = (propname == null) ? null : new String(propname);

Your Mileage May Vary,
Kris