Can we get a memory leak even if the application is killed?

I cannot understand this statement from Activity.onStop () :

When your activity receives a call to the onStop () method, it is no longer visible and should release almost all the resources that are not needed until the user is using it. Once your activity is stopped, the system can destroy the instance if it needs to restore the system Memory. In extreme cases, the system might just kill your application process without triggering the completion of the action in the onDestroy () callback, so it is important to use onStop () to release resources that might be leaking memory.

In particular, this part:

In extreme cases, the system might just kill your application process without calling the completion of the action in the onDestroy () callback, so it is important that you use onStop () to free up resources that might be leaking memory

If the process is killed, how can we get a memory leak if we don't have the release code in onStop

? Are all resources cleared correctly when you uninstall the application?

+3


source to share


2 answers


If the process is killed, how can we get a memory leak if we don't have the release code in onStop?

You can not. Android documentation problems, yo.



Are all resources cleaned up correctly in the application?

Well, your process is complete, which eliminates your RAM and threads. What you need to do is arrange to clean up everything that is not related to your RAM and threads. For example, if a user has entered data into an application that you want to save and has not yet been saved, onStop()

it is time for the candidate to consider fanning out the stream to save that material to disk.

+6


source


If the process is killed. All memory contents associated with it will be removed from the system, so that killing the process will not leak memory.



0


source







All Articles