szhao13 / json-simple

Automatically exported from code.google.com/p/json-simple
Apache License 2.0
0 stars 0 forks source link

Succeptible to OutOfMemoryError heap space issue #46

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Seen in production and not able to reproduce yet
2. Currently assuming that it is happening because of a large array of data.

What is the expected output? What do you see instead?

Expected object to be converted to a JSON string. Instead, ran out of heap.

What version of the product are you using? On what operating system?

version 1.1
jdk1.6.0_13
SunOS 5.10

Please provide any additional information below.

... caught exception: java.lang.OutOfMemoryError: Java heap space
  at java.util.Arrays.copyOf(Arrays.java:2882)
  at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder. java:100)
  at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:572)
  at java.lang.StringBuffer.append(StringBuffer.java:320)
  at org.json.simple.JSONObject.toJSONString(Unknown Source)

Original issue reported on code.google.com by ax2gr...@gmail.com on 25 May 2011 at 8:49

GoogleCodeExporter commented 8 years ago
Please consider using streaming if you have lots of data:
http://code.google.com/p/json-simple/wiki/EncodingExamples#Example_1-4_-_Encode_
a_JSON_object_-_Using_Map_and_streaming

Original comment by fangyid...@gmail.com on 29 May 2011 at 3:32

GoogleCodeExporter commented 8 years ago
And, with respect, I don't think this is actually a "bug" with json.simple 
specifically, so I'm going to go ahead and close this issue.

Original comment by jon.cham...@gmail.com on 10 Aug 2013 at 4:51