On Feb 3, 2012, at 10:28 AM, Wally McClure wrote:
> Not to interject to much into this conversation, but I am fearful of calling 
> GC.Collect() automatically too much.  For example, I find the magnetic field 
> sensor to basically take over my htc evo when I am getting change events.  I 
> realize that you aren't talking about called a .Collect() on every change 
> event.  My concern is that something that fires so often, adding the .Collect 
> will just result in even worse performance.  Granted, I am not privy to the 
> source and have other things to do if I was, so take what I have said for 
> what it is worth.
> 
> Maybe this is a good time for Xamarin to explain the intricacies of the Mono 
> for Android GC?

That would require understanding them. ;-)

(Really, cross-VM GC's are black voodoo; I only partially understand how this 
thing works...)

That said, I'm trying to keep the docs helpful:

        http://docs.xamarin.com/android/advanced_topics/garbage_collection

If there's anything that you would like specifically addressed, please let me 
know and I'll try to update them.

As for the automatic GC.Collect(), we'll also generate a logcat message when we 
do so:

        I/monodroid-gc(PID): 1800 outstanding GREFs. Performing a full GC!

You're really only likely to see this on the emulator, or badly configured 
el-cheapo hardware devices. You'll (unfortunately) need to read the logcat 
output to see this message, but you'll certainly be able to workaround the GC 
as well by just (!) being more "hands-on" with global references and explicitly 
Dispose()ing of objects when you no longer need them. Enabling gref logging to 
see where grefs are being created will help in making this diagnosis:

        
http://docs.xamarin.com/android/advanced_topics/diagnostics#Global_Reference_Messages

 - Jon

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

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

Reply via email to