App crashing after uploading a lot of photos (Binary) in Local storage
Application Type

Hi, I have a simple Gallery app (offline only) and I upload photos using the default upload widget by Outsystems.

The Localstorage I have has very simple attributes: Id, and Binary

Each photo I upload is about 1mb-10mb. After the total amount of size I uploaded takes around 50mb, my app crashes. I noticed that the refreshing of aggregate of Localstorage causes it.

Upon looking at Service Center I got the ff error:

A fatal error has occurred. Please contact OutSystems support: Failed to allocate a 150994952 byte allocation with 25165824 free bytes and 139MB until OOM, target footprint 147136672, growth limit 268435456 

My phone has a lot of free storage so I'm pretty sure it's not the issue here, though it's possible if the phone has very tight space. But in this case, it shouldn't be it.

How do I solve this? thanks


Not sure if this is still useful as two weeks are gone, but the issue is that you are retrieving multiple huge records on that call.

Try removing the Image widget from screen and see if it still breaks.
If not, the issue is that your query result is too big.
Instead of having a Image widget receiving the binary directly from the aggregate, do a block that receives ImageId, retrieves from DB the binary of that single id and shows it in an Image widget.
It will do the same as before, but getting the images one by one instead of overworking from the start.

Hi, thanks for your suggestion

I've already fixed this (with an almost similar idea to yours), I created a custom structure with Id and Binary attribute, then I only query the Id in SQL, and I call an OnAfterFetch to loop the Id list then query the binary and assign one by one. and it worked!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.