Android Question Android memory management

Discussion in 'Android Questions' started by KMatle, Feb 8, 2015.

  1. KMatle

    KMatle Expert Licensed 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.
     
    KZero likes this.
  2. NJDude

    NJDude Expert Licensed 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.
     
    KZero and Peter Simpson like this.
  3. Peter Simpson

    Peter Simpson Expert Licensed User

    Reuse both bitmaps and canvases, try not to create new ones not unless you really really really need to do so...
     
  4. KMatle

    KMatle Expert Licensed 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".
     
  5. Informatix

    Informatix Expert Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice