admin 管理员组

文章数量: 1086019

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 badges
Add a comment  | 

2 Answers 2

Reset to default 2

When 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.

本文标签: Can android app crash lead to memory leakStack Overflow