0

I am trying to understand the benefits of memory consumption by an android application. One direct affect of consuming more memory is that the app crashes more often with OutOfMemoryError. But if my app rarely fails with OutOfMemoryError, is there a benefit in spending time on trying to reduce the memory consumption further ?

Bajji
  • 2,243
  • 2
  • 22
  • 35
  • well your app is obviously going to perform better..... – tyczj Sep 20 '18 at 19:43
  • 1
    If your app fails even once because of an OutOfMemoryError I'd consider that a problem that is worth investigating. Figuring out the root cause might take a little work, but shouldn't be too hard given the useful [memory profiling tool](https://developer.android.com/studio/profile/memory-profiler) that comes with Android Studio. – Michael Krause Sep 20 '18 at 19:51
  • PS: One of the most common causes of OutOfMemoryError I've seen on Android is related to the [loading of assets like ridiculously huge bitmaps](https://stackoverflow.com/questions/477572/strange-out-of-memory-issue-while-loading-an-image-to-a-bitmap-object). – Michael Krause Sep 20 '18 at 20:15
  • Thanks for the comments. Surely, OutOfMemoryError is a sign of memory stress. But I am trying to see if there are any other indirect consequences of behaving well on memory even if there is no outofmemory. – Bajji Sep 20 '18 at 20:25

1 Answers1

1

Avoiding leaks is not as easy as it seems. For example when user changes a configuration resulting the activity to get recreated, your memory consumption becomes almost 2 times due to the leaking activity if of course you have leaks.

The reason you should keep the ram usage as low as you can is about the free part of heap you can get which of course will reduce battery consumption and you can perform tasks on a larger scale. Lets assume you need to crop an image that user requested; this will usually get done by splitting the job into separate chunks and do it in a background thread while showing user a progress. In this example you can bite a larger size of the ram per each chunk and get the job done faster resulting in a happier end-user.

There are plenty other reasons as so to keep your ram usage at a lower level often ends up with more satisfied users.

Sdghasemi
  • 5,370
  • 1
  • 34
  • 42
  • Thanks for the explanation. So if I understand your example correctly, user will perceive the app to be faster (and responsive) if my app has more memory at it's disposal. – Bajji Sep 20 '18 at 20:20
  • @Baji you got the memo ;) – Sdghasemi Sep 20 '18 at 20:21
  • Thanks. I wanted to see if I can come up with any data to prove the worthiness of reducing memory footprint, and I think I now know what to look for :) – Bajji Sep 20 '18 at 20:24