I have pretty simple plugin API and sometimes the Application crashes with : java.lang.OutOfMemoryError:
private boolean getPreviewGroups(final CallbackContext callbackContext) {
this.cordova.getThreadPool().execute(new Runnable() {
public void run() {
try {
// contains JSONArray of previewGroups, and boolean isCreate
JSONObject previewGroupsResponse = WmGroupsMgr.getPreviewGroups();
callbackContext.success(previewGroupsResponse); // <- Crash from this row
} catch (Exception e) {
reportPluginError(e, callbackContext);
}
}
});
return true;
}
Exception:
java.lang.OutOfMemoryError
at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:94)
at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:145)
at java.lang.StringBuilder.append(StringBuilder.java:216)
at org.json.JSONStringer.open(JSONStringer.java:180)
at org.json.JSONStringer.object(JSONStringer.java:158)
at org.json.JSONObject.writeTo(JSONObject.java:670)
at org.json.JSONStringer.value(JSONStringer.java:237)
at org.json.JSONArray.writeTo(JSONArray.java:602)
at org.json.JSONStringer.value(JSONStringer.java:233)
at org.json.JSONObject.writeTo(JSONObject.java:672)
at org.json.JSONStringer.value(JSONStringer.java:237)
at org.json.JSONArray.writeTo(JSONArray.java:602)
at org.json.JSONStringer.value(JSONStringer.java:233)
at org.json.JSONObject.writeTo(JSONObject.java:672)
at org.json.JSONObject.toString(JSONObject.java:641)
at org.apache.cordova.PluginResult.<init>(PluginResult.java:52)
at org.apache.cordova.CallbackContext.success(CallbackContext.java:72)
at com.codelovers.wanameet.plugins.MeeterPlugin$7.run(MeeterPlugin.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Is this any safety way to pass big data through PluginResult?
Thanks,
0 comments:
Post a Comment