Android Handler Memory Leaks
转自:https://techblog.badoo.com/blog/2014/08/28/android-handler-memory-leaks
Android uses Java as a platform for development. This helps us with many low level issues including memory management, platform type dependencies, and so on. However we still sometimes get crashes with OutOfMemory. So where’s the garbage collector?
I’m going to focus on one of the cases where big objects in memory can’t be cleared for a lengthy period of time. This case is not ultimately a memory leak - objects will be collected at some point - so we sometimes ignore it. This is not advisable as it can sometimes lead to OOM errors.
The case I’m describing is the Handler leak, which is usually detected as a warning by Lint.
