Complete
over 4 years ago

WERETECH-7420

Setting the background permission in an app that doesn't have a background process can cause "out of memory" errors when running in the sim (3.0.11)

I've seen this come up in various threads here, and wanted to report it.

If you have an app (WF,DF, etc) where the background permission is set, but where there is nothing annotated as (:background), when the app starts, one or more of these

Failed loading application

Out Of Memory

errors may be displayed.

The reason for "may" has to do with the size of the app.  If it's smaller than the memory available for a background process, they aren't displayed, but if it's larger, you see them. (with one of my WFs, I see them with the 645 but not the 645m as an example)

I'm about 99.9% sure, that there are often 2 is because of 

onAppInstall() and onAppUpdate() which both can run at startup and run in the background.  With the background permission, it wants to run these, and with no annotation, it attempts to load the entire app as the background process.

The work around is to uncheck the background permission if it's not needed.

To reproduce, take any app without a background process that's larger than the memory available for a background process, and give it background permission.  You'll see the messages.  Uncheck the background permission and no messages.

Parents
  • You're right, onAppInstall and onAppUpdate are attempted to be run right after initialize() in the background, but only if the background permission is set. 

    If you put both in AppBase, with just a println, and run without the permission, nothing is displayed when the app starts.  With the permission, and an app that fits the the background, one or both will display.  If the full app won't fit in the background, you see the error(s), but the main app still runs.

    This is really a developer error, in that the permission is being set when not needed and the error messages are is a side effect.  Maybe something in the programmer's guide?

Comment
  • You're right, onAppInstall and onAppUpdate are attempted to be run right after initialize() in the background, but only if the background permission is set. 

    If you put both in AppBase, with just a println, and run without the permission, nothing is displayed when the app starts.  With the permission, and an app that fits the the background, one or both will display.  If the full app won't fit in the background, you see the error(s), but the main app still runs.

    This is really a developer error, in that the permission is being set when not needed and the error messages are is a side effect.  Maybe something in the programmer's guide?

Children
No Data