JsonArray内存不足

时间:2014-07-27 09:03:29

标签: android json

大家好,我想从我的服务器上获取一个json变量。

返回的值可能有多达300个元组,单列。

我有时会出现内存不足错误。

我正在尝试实现这项服务。

try {
        response = CustomHttpClient2.executeHttpPost(
                url,

                as);

        String returnString = response.toString();

        JSONArray jArray = new JSONArray(returnString);

        int jc = jArray.length();
        int count = msl.getCount();

        msl.delete();
        for (int i = 0; i < jArray.length(); i++) {
            {
                try {
                    JSONObject json_data = jArray.getJSONObject(i);
                    response = json_data.getString("pair");
                    // Log.w("coin", apis[ij] + ":pair is-" +
                    // response);

                    long tempres = msl.createEntry(response);
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    // e.printStackTrace();
                    Log.w("coincre", "jsonexception:");

                }

                // Log.w("coincre", "a:" + tempres);

            }
        }
        jArray = null;

    } catch (Exception e) {
        // TODO Auto-generated catch block
        }

我也试过

Runtime.getRuntime().gc();

你能告诉我如何解决这个问题,请不要告诉我增加堆大小

0 个答案:

没有答案
相关问题