Can android app crash lead to memory leak?
AFAIK - activity and services and receivers and content-providers of an app are processes. When the app crashes (eg NoSuchElementException), processes of all these components of the app also die. Then the garbage collection takes care of memory - ie it takes back all the memory used for the system. Hence there should be no memory leaks - but I just wanted to confirm.
Can android app crash lead to memory leak?
AFAIK - activity and services and receivers and content-providers of an app are processes. When the app crashes (eg NoSuchElementException), processes of all these components of the app also die. Then the garbage collection takes care of memory - ie it takes back all the memory used for the system. Hence there should be no memory leaks - but I just wanted to confirm.
Share Improve this question asked Mar 28 at 17:23 Rishabh GuptaRishabh Gupta 8241 gold badge7 silver badges13 bronze badges2 Answers
Reset to default 2When your app crashes, the process is terminated. That means all resources allocated to the process are returned to the OS. So no, it can't cause a memory leak, unless there's an OS level bug in the memory allocator. Which on Linux (the base OS of Android) would be incredibly unlikely.
The garbage collection operation carrier of the art virtual machine is your application process itself.
If the application process crashes, the resource recovery operation is guaranteed by the Android system.