App crash when querying large data from Local Storage

Hi guys,


I stored binary content (picture) into Local Storage, each picture is around 1MB size. When I get the picture from Local Storage by querying via Aggregate, the app was crashed immediately on Android, and the white screen appeared on iOS (I query data to sync to the server).


Is there any size limit returned by the Local Storage Aggregate?


Thanks in advance.

Hi Minh,

If there is a limitation I don't know. But 1Mb should not be a problem at all is my experience 

Do you get an error message? Did you check Service center logs? If you run the app in desktop browser previewer does it also crash?

Regards,

Daniel

Hi Daniel,

Thanks for your reply.

I can't run in the browser preview mode because there are some Cordova plugins installed.

The error is:

java.lang.OutOfMemoryError: Failed to allocate a 150994952 byte allocation with 25165824 free bytes and 81MB until OOM, target footprint 141496208, growth limit 201326592
at java.util.Arrays.copyOf(Arrays.java:3257)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:649)
at java.lang.StringBuilder.append(StringBuilder.java:203)
at org.json.JSONStringer.string(JSONStringer.java:354)
at org.json.JSONStringer.value(JSONStringer.java:261)
at org.json.JSONObject.writeTo(JSONObject.java:733)
at org.json.JSONStringer.value(JSONStringer.java:246)
at org.json.JSONArray.writeTo(JSONArray.java:616)
at org.json.JSONStringer.value(JSONStringer.java:242)
at org.json.JSONObject.writeTo(JSONObject.java:733)
at org.json.JSONStringer.value(JSONStringer.java:246)
at org.json.JSONObject.writeTo(JSONObject.java:733)
at org.json.JSONStringer.value(JSONStringer.java:246)
at org.json.JSONArray.writeTo(JSONArray.java:616)
at org.json.JSONArray.toString(JSONArray.java:587)
at org.apache.cordova.PluginResult.<init>(PluginResult.java:49)
at org.apache.cordova.CallbackContext.success(CallbackContext.java:88)
at io.sqlc.SQLiteConnectorDatabase.executeSqlBatch(SQLiteConnectorDatabase.java:176)
at io.sqlc.SQLitePlugin$DBRunner.run(SQLitePlugin.java:357)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)


I did debug on the Android phone and it was crashed at the Aggregate... :(



Hi,

You get an out of memory error. So apparently the device you use has not enough available memory to complete the task.

Could you check your device memory specs then try o. A device with more memory and see if the problem then does not occur?

Regards,

Daniel