I have a very simple application which has a problem with getting
ListViews to be freed by the GC.  I have a ViewGroup which has a
ListView.  When the page with the ViewGroup no longer has any
references to it, and I force a GC, the ListView is not freed.

The project in question is quite small and can be found at
http://gabysoft.com/download/MemoryLeak.zip.  If you run it, the first
page has a button and a ListView (which has no items so you cannot see
it).  When you press the button it switches to a second page which has
just a button.  When you press the button on the second page, it
creates a new ViewGroup and ListView and sets that as the current
view.  Thus, every time you switch pages, a new ViewGroup/ListView is
created, and all references to the old one go away.  Hence the old one
should be GC'd.  However if you switch views 20 times and then force a
GC you will see that the ListViews are never freed (i.e. their
finalize method (which is logged) is not called).

Now here is the really weird part.  This happens ONLY if I build my
project using Eclipse.  If I use Ant to build and install the project,
the ListViews are all freed when I do a GC as you would expect.  Why
would the Eclipse version exhibit this behavior?

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

Reply via email to