Thank you Jon. I will try your suggestion.

Did it allow GC to free up those instances of ImageGridActivity? Their presence 
seemed to lock in the GridView's, and thus the ImageView's.

David

Sent from my iPad

On Dec 16, 2011, at 3:47 PM, "Jonathan Pryor-2 [via Mono for Android]" 
<ml-node+s1047100n5081548...@n5.nabble.com> wrote:

> On Dec 16, 2011, at 9:43 AM, HSSoftware wrote: 
> > Attached is a reproducible case. 
> 
> Thank you, that simplified investigations. :-) 
> 
> > Is there something stupid I am doing, or is GC on a holiday? 
> 
> The GC is on holiday. :-) 
> 
> Well, not exactly. The problem here is that the GC has a limited view of 
> memory -- it only knows about the memory it's allocated. In the interest of 
> being performant, it doesn't want to perform collections that often, as 
> collections are slow. So collections are only performed when the GC thinks 
> it's allocated "enough" memory (subject to configuration, etc.). 
> 
> The problem here is that Mono's GC doesn't know about memory allocated by the 
> Android GC, and thus Mono's GC doesn't know that a _ton_ of memory is being 
> kept alive by Mono; all Mono's GC sees is a lot of (comparatively small) 
> instances running around. Consider that for most managed objects, the only 
> instance data is a couple of IntPtrs (to hold the JNI handle value) -- sgen 
> thinks your Bitmap instance is only ~28 bytes in size, so you can allocate 
> LOTS of those before triggering a collection... 
> 
> The short-term fix is to help the GC out, by overriding 
> ImageGridActivity.OnDestroy() and invoking GC.Collect(): 
> 
>         protected override void OnDestroy () 
>         { 
>                 base.OnDestroy (); 
>                 GC.Collect (); 
>         } 
> 
> Once I do that, your test app stabilizes at ~255 global references on my 
> Xoom. 
> 
> The longer-term fix involves us adding GC.AddMemoryPressure() and 
> GC.RemoveMemoryPressure() support and some "glue" logic so that sgen "knows" 
> how big the Java-side bitmap actually is, and use that to modify how often 
> collections are performed. There's no ETA on this. 
> 
>  - Jon 
> 
> _______________________________________________ 
> Monodroid mailing list 
> [hidden email] 
> 
> UNSUBSCRIBE INFORMATION: 
> http://lists.ximian.com/mailman/listinfo/monodroid
> 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://mono-for-android.1047100.n5.nabble.com/GridView-not-releasing-view-objects-tp5078401p5081548.html
> To unsubscribe from GridView not releasing view objects, click here.
> NAML


--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Re-SPAM-LOW-Re-GridView-not-releasing-view-objects-tp5081566p5081566.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to