Thanks for the response. I have worked out a work-around which fixes the problem. Instead of setting the view group via setContentView(vg), I am now setting a FrameLayout as the content view, and then setting the view group as the child of the FrameLayout. In addition, it was necessary to not remove the old view when setting a new view, but rather hide it. Then when subsequent views are set, the oldest view is removed. It seems that the problem stems from removing a view while processing a message from a child control in that view. If I don't do that, then the view is properly recycled. Again note that this seems to be a problem only for 1.6 (and possibly earlier). It seems to work properly with 2.0 and above.
On Jan 2, 8:32 am, Prateek Jain <mrprateekj...@gmail.com> wrote: > Hi John, > > If you can post the logs would help understand the reason of the > memory leak. Also, a small sample of code will be helpful. > > Cheers, > Prateek > > On Jan 1, 12:32 am, John Gaby <jg...@gabysoft.com> wrote: > > > I seem to have a memory leak when running under version 1.6 of the > > OS. I have a custom view group which contains some controls and I set > > it to be the current view via a call to setContentView(vg). If I then > > create a second view group and set it as the active view via > > setContentView(newVg), the first view group is never freed (even when > > I force a garbage collection). > > > Note that this works fine for versions 2.0 and above, so it is > > possible that 1.6 has some kind of bug. If so, does anyone know of a > > workaround? I can post a simple example of this problem if it would > > help. > > > Thanks. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en