[mono-android] Possible GC Bug?

Jonathan Pryor jpryor at novell.com
Fri Mar 18 19:29:06 EDT 2011


On Mar 18, 2011, at 5:24 PM, Aaron Knabb wrote:
> Thanks for your input Jon. So if I understand correctly, I should call GC.Collect regularly?

No. The problem is that, just as with .NET, the GC has a variety of heuristics that control when it collects, and GC.Collect() can screw them up. _Normally_, you should _avoid_ calling GC.Collect() _unless_ you KNOW that it's a good idea. Knowing that a huge Java-side bitmap has been released is one such scenario (but see also Mike Kestner's followup), as is when overriding Activity.OnLowMemory().

 - Jon



More information about the Monodroid mailing list