Issue
Now, I am aware that there is no such thing as "exiting" an app in Android. By this I mean that the process corresponding to an app is kept in memory even after all the activities in that app are destroyed. (For sake of simplicity, let's keep services and such out of the picture). The process is only killed when the system decides to do so in order to reclaim memory.
However, once all my activities have been destroyed, I would assume that the process corresponding to my app is no longer "active". By this I mean that since my app is not doing any work, I assume the process no longer performs allocations. Is this assumption correct?
I used the simple default HelloWorld
example that Eclipse ADT gives me via the New Android Project Wizard
and saw that this is not the case. Even after I close the app, I can still track allocations in DDMS. Can anyone explain the reason for this?
Solution
Allocation tracker has hints for you: columns Thread Id and Allocated in. Watch these, and you'll learn which object and method did the allocation.
My inactive app shows allocations in DdmServer, which indicates that memory is used for DDMS service to work.
If you get other kind of allocations, check if your app has some outstanding threads, or other tasks that may be still running in background. If this is the case, make sure to do cleanup in Activity.onDestroy.
Answered By - Pointer Null
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.