Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Trusted Contributor
Brennan12325
Posts: 204
Registered: ‎05-15-2012
My Device: None

Memory Usage Limitations

How much memory is my application allowed to use while it's backgrounding? My app is fairly frequently killed when it receives a device memory low, level 2, signal (while it is in the background). This is while my app is using about 20M memory.

 

I'm assuming at some point the OS won't kill my app because the memory it's using is negligable, or within some allowed amount? Anyone know that point? I can see that other apps on the device aren't killed when the low memory signals are thrown.

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Memory Usage Limitations

I'm not aware of, and have never observed, any sort of per-app limits.

At one point I had a memory leak in one of my apps which, over hours, gradually consumed hundreds of megabytes. The system never terminated the app on me, whether foregrounded or backgrounded. I'm sure I had the app using over 300MB at some points.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Trusted Contributor
Brennan12325
Posts: 204
Registered: ‎05-15-2012
My Device: None

Re: Memory Usage Limitations

Weird, I wonder why my app is being killed, then. It always happens right after a high priority memory warning while its in the background.

 

Usually if I run the app, background it, then open blackberry world, the browser, and one other app, it will get the memory warning and die.

 

I sometimes get warnings while its in the foreground too, but the OS never seems to act upon them while i'm foregrounding (ie, my app is never killed).

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Memory Usage Limitations

The app in question, in my case, had requested run_when_backgrounded permission. Perhaps that could affect how the OS treats it under low-memory conditions. Does yours do that too? (You wouldn't want to unless the app actually does need to do some background processing... using that merely to avoid getting killed under low-memory conditions would be an abuse of the feature, and likely bite you in future.)

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
ekke
Posts: 1,544
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Memory Usage Limitations

are you using a Z10 or a DevAlpha A/B ?

DevAlpha A/B only have 1 GB so you cannot compare them with real devices in respect of memory

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Trusted Contributor
Brennan12325
Posts: 204
Registered: ‎05-15-2012
My Device: None

Re: Memory Usage Limitations

[ Edited ]

The problem is present on both the Dev Alpha B and C, I don't  have a Z10 to test on.

 

My app does request (and make use of) running in the background to periodically check for updates. These updates don't really use much memory, though, and have a negligible effect on the amount of memory the app uses (it effectively uses the same amount of memory while running in the background doing nothing as it does while running in the background querying for updates).

 

The Z10 has more memory, but I'm not sure if that would change the behavior I'm seeing? Certainly the user would probably have to open more apps to get the device low on memory, but I'm assuming I'd still receive memory warnings and be killed when the device was low on memory?

 

I guess if the Z10 never runs into memory warnings with 8 apps open, then this is more or less a non-issue, but I definitely don't want my app dieing while it's backgrounding, since it sends 'important' notifications to the user.

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Please use plain text.
Developer
ekke
Posts: 1,544
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Memory Usage Limitations

DevAlpha C has 2 GB - so this seems not to be a 1 GB problem

 

perhaps you should do some more profiling and tests and open an issue.

 

If a Device runs into low memory, then it seems valid (for me) to kill the oldest opened minimized app by OS.

what else could be the solution ?

 

if you're running important thinngs you have to test for low memory and send a notification to the Hub or so to inform the user that he/she has to close one or more apps to avoid that your app will be killed

 

for important background operations you have to wait for Services running in the background -

there will be some info on this at BBJam in Orlando.

 

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Developer
superdirt
Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Re: Memory Usage Limitations

20 mb represents 1-2% of the system memory. I don't think the system would shut down an app for using only 1-2%. Are you sure it's only using 20 mb?

Please use plain text.
BlackBerry Development Advisor
tolang
Posts: 47
Registered: ‎04-19-2013
My Device: I love them all!

Re: Memory Usage Limitations

Any application not currently in the foreground is a potential candidate for harvesting in critical memory situations.
Please use plain text.