I was running on Android emulator API Level 7 (2.1) Curiously, I just tried the same code on Android emulator API Level 15 and it behaved completely differently. The app didn't lock up like it does on API Level 7.
I don't know. I don't fully understand it all yet (haven't had time to do further research yet) but something just doesn't seem right. It feels like a bug to me. Let me again re-iterate that I know the way I'm doing this is not the most efficient way. And I do plan to switch over to using a ListView. But it still feels very buggy. If what I am mistaking as a bug is actually just a limitation of Mono for Android then please correct me. On API Level 7 it seems that garbage collection is finally kicking in after it reaches around 1900 grefs. I'm fine with this. But what surprises me is that it seems to go haywire and continue to run full GC over and over again. I'm not seeing this behavior on API Level 15. Even after it finishes doing full GC and it says that the "GREF has decreased to 299", the next time I click the button it runs full GC again! I would have thought that it wouldn't need to run full GC again for at least another 10-20 clicks of the button. So yes it seems like resources are not being released. I'd be suspicious of Android/Java except that I have tried it in Java and it works fine. Anyways I am attaching 2 different logs from my logcat. The first log is from logcat on Android API Level 7: http://codeviewer.org/view/code:2895 The second log is from logcat on Android API Level 15: http://codeviewer.org/view/code:2896 Hopefully these two logs will provide some insight. I have added an additional logging line that records every time I pressed the button (at the beginning of the event handler). Also, you mentioned that you were confused by the 2200+ gref count. I can consistently reproduce these high counts on the API Level 7 emulator. -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/How-to-handle-garbage-collection-memory-leak-tp5711079p5711096.html Sent from the Mono for Android mailing list archive at Nabble.com. _______________________________________________ Monodroid mailing list [email protected] UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
