Search code examples
androidperformancememory-managementout-of-memoryandroid-memory

How can i do memory management in my Android Application?


I'm building an Android Application where i have more than 5 Activities. Many of them have fragments which loads endless list with images and text (Just like any other e-Commerce Product listing page) in RecyclerView. Now when i come back to 1st Activity from 5th activity, it throws OutOfMemoryException and is using a lot of Memory. Which mechanism and how should i use it in such a way that cleans the unused memory when possible.


Solution

  • Implement this https://github.com/square/leakcanary this is a library to monitor your memory leaks in which throws the OOM exception error. It will also direct you to where the memory leaks are coming from.