https://bugzilla.novell.com/show_bug.cgi?id=638714
https://bugzilla.novell.com/show_bug.cgi?id=638714#c0 Summary: LocalReference to IRunnableAdapter not getting released Classification: Mono Product: MonoDroid Version: SVN Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: Class Libraries AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- When an Action is used with Activity.RunOnUiThread (action), the corresponding IRunnableAdapter's local ref doesn't get released. To reproduce, change the Button sample's OnCreate method to (adds the timer): ---------- protected override void OnCreate (Bundle bundle) { #if MONODROID_TIMING Logger.Log(LogLevel.Info, "MonoDroid-Timing", "ButtonActivity.OnCreate: time: " + (DateTime.Now - new DateTime (1970, 1, 1)).TotalMilliseconds); #endif base.OnCreate (bundle); // Create your application here Android.Widget.Button button = new Android.Widget.Button (this); button.Text = string.Format ("{0} clicks!!", count); button.Click += delegate { button.Text = string.Format ("{0} clicks!!", ++count); }; // ** Add these two lines j_timer = new Java.Util.Timer (); j_timer.Schedule (new FooTimerTask (s => RunOnUiThread (() => count++)), 100, 1); // *** SetContentView (button); } ----------- After running for some time, the application crashes with this in the log: ------------ W/dalvikvm( 5239): ReferenceTable overflow (max=51200) W/dalvikvm( 5239): Last 10 entries in JNI global reference table: W/dalvikvm( 5239): 51190: 0x481ccab0 cls=Lmono/java/lang/IRunnableAdapter; (12 bytes) W/dalvikvm( 5239): 51191: 0x481ccac0 cls=Lmono/java/lang/IRunnableAdapter; (12 bytes) W/dalvikvm( 5239): 51192: 0x481ccad0 cls=Lmono/java/lang/IRunnableAdapter; (12 bytes) W/dalvikvm( 5239): 51193: 0x481ccae0 cls=Lmono/java/lang/IRunnableAdapter; (12 bytes) W/dalvikvm( 5239): 51194: 0x481ccaf0 cls=Lmono/java/lang/IRunnableAdapter; (12 bytes) W/dalvikvm( 5239): 51195: 0x481ccb00 cls=Lmono/java/lang/IRunnableAdapter; (12 bytes) W/dalvikvm( 5239): 51196: 0x481ccb10 cls=Lmono/java/lang/IRunnableAdapter; (12 bytes) W/dalvikvm( 5239): 51197: 0x481ccb20 cls=Lmono/java/lang/IRunnableAdapter; (12 bytes) W/dalvikvm( 5239): 51198: 0x481ccb30 cls=Lmono/java/lang/IRunnableAdapter; (12 bytes) W/dalvikvm( 5239): 51199: 0x481ccb40 cls=Lmono/java/lang/IRunnableAdapter; (12 bytes) W/dalvikvm( 5239): JNI global reference table summary (51200 entries): W/dalvikvm( 5239): 107 of Ljava/lang/Class; 172B (68 unique) W/dalvikvm( 5239): 2 of Ldalvik/system/VMRuntime; 12B (1 unique) W/dalvikvm( 5239): 1 of Ljava/lang/String; 28B W/dalvikvm( 5239): 13 of Ljava/lang/ref/WeakReference; 28B (13 unique) W/dalvikvm( 5239): 1 of Landroid/app/ActivityThread$ApplicationThread; 28B W/dalvikvm( 5239): 1 of Landroid/app/ActivityThread$ProviderRecord; 28B W/dalvikvm( 5239): 1 of Landroid/app/ActivityThread$PackageInfo$ServiceDispatcher$InnerConnection; 28B W/dalvikvm( 5239): 1 of Landroid/database/ContentObserver$Transport; 28B W/dalvikvm( 5239): 1 of Landroid/widget/Button; 548B W/dalvikvm( 5239): 2 of Landroid/view/ViewRoot$W; 28B (2 unique) W/dalvikvm( 5239): 1 of Landroid/view/accessibility/AccessibilityManager$1; 28B W/dalvikvm( 5239): 1 of Landroid/view/inputmethod/InputMethodManager$1; 28B W/dalvikvm( 5239): 1 of Landroid/view/inputmethod/InputMethodManager$ControlledInputConnectionWrapper; 36B W/dalvikvm( 5239): 1 of Lmono/samples/button/ButtonActivity; 180B W/dalvikvm( 5239): 1 of Lmono/android/view/view/OnClickListenerAdapter; 12B W/dalvikvm( 5239): 1 of Ljava/util/Timer; 20B W/dalvikvm( 5239): 1 of Lmono/samples/button/FooTimerTask; 44B W/dalvikvm( 5239): 50954 of Lmono/java/lang/IRunnableAdapter; 12B (50954 unique) W/dalvikvm( 5239): 109 of Lmono/java/lang/IRunnableAdapter; 20B (109 unique) W/dalvikvm( 5239): Memory held directly by native code is 626792 bytes E/dalvikvm( 5239): Failed adding to JNI global ref table (51200 entries) E/dalvikvm( 5239): VM aborting -------------- -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
