Android "force close" what exactly happens with memory

I have several services in my application. The application runs in the process of "android.uid.system". When I click force close, then the logs say:

Forced Stop Package com.sec.ims.android uid = 1000 Forced Stop Service ServiceRecord {42b9a948 ... .....

I see that for each service running under my application. There is no call to onDestroy () at all. I am wondering what exactly does android do after "closing the power"? Stopping the whole process or just stopping all services, actions running under the application?

Do you know what happens to objects, static variables and threads that were created by these services? Does android delete all the heap of memory for this application?

+4
source share
3 answers

A Force Stop will destroy the virtual machine (virtual machine) in which the application is running. All objects, services and activities are killed.

+1
source

It depends on how you started the service.

Using startService() overrides the default service life, which is controlled by bindService() .

When startService() , your service lifecycle remains when the original activity is closed.

In both cases, Android stops services when memory is required.

+1
source

I think. This problem is a problem with low memory. Android PF kills a living process when a more complex priority process requires heaps.

[ps]

  • if you are creating a low memory situation. I recommend you use the following application. http://kyorohiro.blogspot.jp/2013/02/inside-kyorostress-1-produce-low-memory.html

  • If this problem is related to a low memory problem, your service and process will be restarted. but your application data is erased in the java heap.

  • if PF restarts your process. then call the createCreate () command.

  • The service life cycle is changed using the onStartCommand return value. check android api refernce.
0
source

All Articles