android java lang abstractstringbuilder enlargebuffer out of memory error -
in application try implement cache data in device present in offline mode. works fine before crash.
fatal exception: java.lang.outofmemoryerror @ java.lang.abstractstringbuilder.enlargebuffer(abstractstringbuilder.java:94) @ java.lang.abstractstringbuilder.append0(abstractstringbuilder.java:132) @ java.lang.stringbuilder.append(stringbuilder.java:124) @ org.json.jsonstringer.string(jsonstringer.java:344) @ org.json.jsonstringer.value(jsonstringer.java:252) @ org.json.jsonobject.writeto(jsonobject.java:672) @ org.json.jsonstringer.value(jsonstringer.java:237) @ org.json.jsonobject.writeto(jsonobject.java:672) @ org.json.jsonstringer.value(jsonstringer.java:237) @ org.json.jsonobject.writeto(jsonobject.java:672) @ org.json.jsonstringer.value(jsonstringer.java:237) @ org.json.jsonobject.writeto(jsonobject.java:672) @ org.json.jsonstringer.value(jsonstringer.java:237) @ org.json.jsonarray.writeto(jsonarray.java:602) @ org.json.jsonstringer.value(jsonstringer.java:233) @ org.json.jsonobject.writeto(jsonobject.java:672) @ org.json.jsonobject.tostring(jsonobject.java:641)
and line issue happen
mcaching.cache(response.tostring(), caching.type_global);
issue happen try convert jsonobject
string in code response.tostring()
after search problem answers suggest add android:largeheap="true"
in application manifest file add before crash produced. ?
most object you're trying write json has circular reference loop. it's quite difficult run out of memory unless you're loading lot of huge images, text content, not much, unless data you're saving huge, doubt.
regardless in case should consider writing json directly file instead of memory string. also, it's best write temporary file first, move file replace saved data, save in case writing fails mid-operation.
Comments
Post a Comment