Runtime Error : java.lang.OutOfMemoryError:

Hi guys, I have a Google sheet and I want to read from the sheet and write to this sheet with the app. I have 5 screens and I used this guide for screen transition: so I think my problem isn't because of screen transition. 2 screens are not important for now I don't do anything on these pages. I want to read and write on my main page, and the Data and Error pages only read the from sheet, I show them on the app.I have got this error :

Main Screen:

Error Screen (Data and Error Screen are similar):

What do you think about this error and how to fix it?

You need to stop the Clock Timers before you switch screens.

You get a race condition causing the OOM error.

By the way,

What kind of data lives in 2 rows and 200 columns?

Like this :

But I got same error

Did you do the same on your "Main Screen"?

yes I did it all screens , Main Screen :

Remove / turn off all the clocks and test

I removed all the clocks I got the same error. In addition, I tested only page transition for all pages I don't get any error.

OK, you do not say when the error occurs ?

Why are you using a Clock to do a Web.Get request? How did you set the timer interval? It looks like you are overwhelming your device. .You should not do that...

What about asynchronous processing? After having received the result then call Web.Get again without using any clock...

This page describes the principle App Inventor Tutorials and Examples: Webprefetch File by File | Pura Vida Apps


I using a clock because I want to read to sheet every 5 second, my esp32 board send data to sheet every 5-6 seconds so I need the latest data


Please show us an updated screenshot so we can see you diabling the clocks before switching screens

Also let us know


Main (Manager Screen) :

Data screen :

Ok, fine
So when exactly does the error occur? Please describe what you are doing and which screens do you visit. . Thr error hapoens after a while on the data screen? Please elaborate


After starting the application, I can switch between screens. After 3-4 transitions, I cannot switch. The application crashes. Sometimes the application closes itself automatically, sometimes it does not allow me to press the buttons I use to switch screens, or even if I press it, it does not switch between screens. These usually occur when I am on the data screen. When I tried all the screens one by one, the same error occurred again.

What kind of data are you downloading using the web component?
It is a huge table with 225 columns and how many rows?
And you are using only a small part of that data in the app. .
Probably it is possible to download only that part of data you really need?


If you are requesting data from a Google Sheet every 5 seconds, how do you take into account the possibility that it might be taking more than 5 seconds to respond to your request?

This might be a Lucy and Ethel in the Chocolate Factory situation.

1 Like

115 pieces of data come from Esp32 every 5-6 seconds. I write this data into first 115 rows and Esp32 works continuously and the number of columns constantly increases. I save the last incoming data set after the 115th row. The first line contains the data name and the second line contains the data value. I aim to read the data in the 2nd line with the app and show the current data to the user in the mobile application.

Let me suggest you to redesign...
In the data screen each time you get a larger table with more rows and too much unnecessary data... don't do that... simplify and get only the necessary data


It's possible in Google Sheets to add extra sheets with summarizations like =MAXIFS() that you can use to reduce your data traffic if you just want to see the most recent data.

Sample app: