[Helma-user] Parsing JSON

Kris Leite kleite at imcsoftware.com
Mon Nov 26 20:45:20 CET 2007


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



More information about the Helma-user mailing list