Open DavePearce opened 2 years ago
It seems that JSONObject.toString() is causing an out-of-memory error on large files (e.g. stMemoryTest/buffer.json). Specifically at this point:
JSONObject.toString()
stMemoryTest/buffer.json
public void run() throws IOException, JSONException { // Read contents of fixture file String contents = Files.readString(inFile); JSONObject json = convertState2TraceTest(new JSONObject(contents)); if(prettify) { out.print(json.toString(2)); } else { out.print(json.toString()); // crashes here. } }
I wonder what we can do about this. For example, some kind of convert on demand approach using an OutputStream ?
OutputStream
Potentially the JSONWriter class might be the ticket here. Yes, convertState2TraceTest can be modified to use this, and that would probably help significantly.
JSONWriter
convertState2TraceTest
It seems that
JSONObject.toString()
is causing an out-of-memory error on large files (e.g.stMemoryTest/buffer.json
). Specifically at this point:I wonder what we can do about this. For example, some kind of convert on demand approach using an
OutputStream
?