我正在調用Web服務在地圖上繪製點。我在響應中找到了750條記錄。而第二次加載頁面則會顯示此錯誤。在處理Web服務中的響應期間出現錯誤
致命異常:螺紋26 java.lang.OutOfMemoryError 在java.lang.String中(String.java:513) 在org.apache.http.util.CharArrayBuffer.toString(CharArrayBuffer.java:261。 ) at org.apache.http.util.EntityUtils.toString(EntityUtils.java:141) at org.apache.http.util.EntityUtils.toString(EntityUtils.java:146) at org.apache.http.impl .client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:76) at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:59) at org.apache.http.impl.client.AbstractHttpClient.execute (AbstractHttpClient.java:657) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:627) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:616) at com.roundmenu.Nearme .RUN(Nearme.java:583) 在java.lang.Thread.run(Thread.java:1019)
@Override
public void run() {
try {
HttpGet post = null;
Log.e("", "Share.isfromfilter = " + Share.isfromfilter);
if (Share.isfromfilter) {
Log.e("", "Teset 1");
Log.e("", "Share.CuisineValue = " + Share.CuisineValue);
if (Share.CuisineValue.equalsIgnoreCase("")) {
Log.e("", "Teset 2");
post = new HttpGet("my url here");
} else {
Log.e("", "Teset 3");
post = new HttpGet("my url here");
}
} else {
Log.e("", "Teset 4");
post = new HttpGet("my url here");
}
post.addHeader("apikey", "880639B3638597349AC1BE6F70FC5682");
ResponseHandler<String> responseHandler = new BasicResponseHandler();
response = client.execute(post, responseHandler);
System.out.println("----------------------------------------");
System.out.println(response);
handler.sendEmptyMessage(0);
} catch (Exception e) {
e.printStackTrace();
handler.sendEmptyMessage(1);
}
}
我的這段代碼執行過程中也得到了VM預算外資金錯誤的。
我收到23000個字節的數據在我的迴應 – dilipkaklotar
這很難說,並確定在調用堆棧的回溯根源基地。您可以嘗試DDMS來檢查您的應用程序中的堆/ RAM使用情況。 – jclin