异常内存不足“Thread-451”prio = 5 tid = 11 RUNNABLE

时间:2012-10-19 14:48:46

标签: android

我不是想下载图片。我试图从服务器获得json响应。 当响应很小时,一切都很顺利。但是,当我得到一个巨大的回应,我得到一个例外。

10-19 16:32:12.226: E/dalvikvm-heap(5504): Out of memory on a 33554448-byte allocation.
10-19 16:32:12.230: I/dalvikvm(5504): "Thread-451" prio=5 tid=11 RUNNABLE
10-19 16:32:12.230: I/dalvikvm(5504):   | group="main" sCount=0 dsCount=0 obj=0x418c44d0 self=0x50ecd140
10-19 16:32:12.230: I/dalvikvm(5504):   | sysTid=5723 nice=0 sched=0/0 cgrp=apps handle=1361164216
10-19 16:32:12.230: I/dalvikvm(5504):   | schedstat=( 0 0 0 ) utm=176 stm=69 core=0
10-19 16:32:12.258: I/dalvikvm(5504):   at org.apache.http.util.CharArrayBuffer.expand(CharArrayBuffer.java:~59)
10-19 16:32:12.258: I/dalvikvm(5504):   at org.apache.http.util.CharArrayBuffer.append(CharArrayBuffer.java:77)
10-19 16:32:12.258: I/dalvikvm(5504):   at org.apache.http.util.EntityUtils.toString(EntityUtils.java:136)
10-19 16:32:12.258: I/dalvikvm(5504):   at org.apache.http.util.EntityUtils.toString(EntityUtils.java:146)
10-19 16:32:12.265: I/dalvikvm(5504):   at fr.haploid.webservices.parsers.WebServiceJSONObjectParser$MyNetworkThread.work(WebServiceJSONObjectParser.java:198)
10-19 16:32:12.265: I/dalvikvm(5504):   at fr.haploid.webservices.parsers.WebServiceParser$NetworkThread.run(WebServiceParser.java:653)
10-19 16:32:12.273: W/dalvikvm(5504): threadid=11: thread exiting with uncaught exception (group=0x40fb4300)
10-19 16:32:12.297: E/AndroidRuntime(5504): FATAL EXCEPTION: Thread-451
10-19 16:32:12.297: E/AndroidRuntime(5504): java.lang.OutOfMemoryError
10-19 16:32:12.297: E/AndroidRuntime(5504):     at org.apache.http.util.CharArrayBuffer.expand(CharArrayBuffer.java:59)
10-19 16:32:12.297: E/AndroidRuntime(5504):     at org.apache.http.util.CharArrayBuffer.append(CharArrayBuffer.java:77)
10-19 16:32:12.297: E/AndroidRuntime(5504):     at org.apache.http.util.EntityUtils.toString(EntityUtils.java:136)
10-19 16:32:12.297: E/AndroidRuntime(5504):     at org.apache.http.util.EntityUtils.toString(EntityUtils.java:146)
10-19 16:32:12.297: E/AndroidRuntime(5504):     at fr.haploid.webservices.parsers.WebServiceJSONObjectParser$MyNetworkThread.work(WebServiceJSONObjectParser.java:198)
10-19 16:32:12.297: E/AndroidRuntime(5504):     at fr.haploid.webservices.parsers.WebServiceParser$NetworkThread.run(WebServiceParser.java:653)
10-19 16:37:12.367: I/Process(5504): Sending signal. PID: 5504 SIG: 9

有谁知道我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

不幸的是,没有什么魔法可做!您需要更改Web服务以更轻松地发送json文件。我相信你可以在几个部分剪切你的json文件。如果它是一个很长的列表,你可以考虑分页。