Android Question Android memory management

KMatle

Expert
Licensed User
Longtime User
We had some threads about "out of memory" issues, etc and there are articles about it f.e. here:

https://developer.android.com/training/articles/memory.html

It would be very helpful if someone could write down what is stored where and how and how much memory for what is available to an app.

My S4 has 2 GB of RAM and I know that 10+ images 1920x1080 (=8-10 MB) will cause a "out of memory" and I still wonder why I must use shitty sized images (pardon for that) or make a huge logic to reuse them.
 

NJDude

Expert
Licensed User
Longtime User
If you have huge images, you have to load them only once and reuse them, if you keep creating new ImageViews and loading the images you will run out of memory in no time, there are samples on the forums to illustrate what I just mentioned.

Take a look at some of the links above under SIMILAR THREADS.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Yep. But's it's still funny to me not having more than 24 - 48 MB (or perhaps a bit more but not garantied with largeheap) for an app on a phone having 2 or even 3 GB of RAM. My intention was to have a "predictable behaviour" of the memory management. It's more like a "random" behaviour like use any view and reuse it "by chance" but you never can be sure not to get into trouble if it's "one too much".
 
Upvote 0
Top