Did you read that ? http://android-developers.blogspot.com/2009/01/avoiding-memory-leaks.html
On Feb 4, 12:46 pm, Gw1921 <[email protected]> wrote: > Hi > > I'm trying to track down memory leaks in my application. It seems the > total amount of memory the app really needs is perhaps around 3MB > (Maximum, on average it's around 2.1MB). There's only one activity in > the whole app which uses max amount of memory. > > However, every time I switch from that activity back to the main entry- > point activity (which shows the user an index of available options), > it seems the previous activity was not garbage collected. I have the > following concerns: > > 1. I'm not sure if this is because I've kept a reference to some > global resource in the previous activity that it's not being collected > 3. I'm not sure if this is how Android works, i.e. GC on activities > are delayed. > > I'm using a lot of drawables (included as assets and resource) in the > other memory-hogging activity. Am I supposed to 'reset' the views > somehow in order to remove the reference to these globally accessible > resources? I'm also reading a number of files from the SD Card (saved/ > created in a separate activity). > > Or am I supposed to somehow ensure that the activity is 'killed' in a > way? In order to get back to the main Index (from which the user > navigates to the other activity), I'm simply calling startActivity(new > Intent("com.blah.MAININDEX")); > > Any help would be much appreciated. I'm not sure if I completely > understand how references are incremented and decremented for a given > view in Android. > > Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

