如何解决"扩大缓冲区"错误?

时间:2011-03-05 05:56:55

标签: android

我正在开发Android应用程序。我正在阅读大流JSON文件。我收到了这个错误。我该如何解决?

03-05 11:13:57.760: ERROR/dalvikvm-heap(14415): Out of memory on a 11634218-byte allocation.
03-05 11:13:57.760: INFO/dalvikvm(14415): "Thread-24" prio=5 tid=10 RUNNABLE JIT
03-05 11:13:57.760: INFO/dalvikvm(14415):   | group="main" sCount=0 dsCount=0 s=N obj=0x44940b90 self=0x2b3738
03-05 11:13:57.760: INFO/dalvikvm(14415):   | sysTid=14429 nice=0 sched=0/0 cgrp=default handle=2820104
03-05 11:13:57.760: INFO/dalvikvm(14415):   | schedstat=( 10163055454 12282440153 11858 )
03-05 11:13:57.760: INFO/dalvikvm(14415):   at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:~97)
03-05 11:13:57.760: INFO/dalvikvm(14415):   at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:157)
03-05 11:13:57.760: INFO/dalvikvm(14415):   at java.lang.StringBuilder.append(StringBuilder.java:217)
03-05 11:13:57.760: INFO/dalvikvm(14415):   at ez.com.apiconnection.convertStreamToString(apiconnection.java:89)
03-05 11:13:57.760: INFO/dalvikvm(14415):   at ez.com.apiconnection.urlconn(apiconnection.java:43)
03-05 11:13:57.760: INFO/dalvikvm(14415):   at ez.com.Day_API_Parse.dayall(Day_API_Parse.java:289)
03-05 11:13:57.760: INFO/dalvikvm(14415):   at ez.com.Action_module_screen$3.run(Action_module_screen.java:700)
03-05 11:13:57.760: INFO/dalvikvm(14415):   at java.lang.Thread.run(Thread.java:1096)
03-05 11:13:57.760: INFO/dalvikvm(14415):   at java.lang.Thread.run(Thread.java:1096)

1 个答案:

答案 0 :(得分:0)

尝试在流模式下使用其他库,例如GsonJackson。标准org.json库不支持流式传输,并且经常在大型JSON文档上抛出OutOfMemory错误。