I have been working to find lost Global References in my application. I have been able to find and address just about everything, but I have some questions about the information in the debug.mono.log data.
First I seem to get a recurring Global Reference allocation with the *same* address, that never seems to be deallocated. But the information doesn't point me to anywhere that I can find in my code. I was hoping someone had an idea of what a NoClassDefError might be related to. It seems to occur shortly after each GC pass. So I lose a global handle every ~30s or so. The handle is always the same: 0x4001518 -------------------------- I/monodroid-gref(18413): +g+ grefc 245 gwrefc 0 obj-handle 0x40015158/L -> new-handle 0x40015158/L from at Java.Lang.Object.RegisterInstance(IJavaObject instance, IntPtr value, JniHandleOwnership transfer) I/monodroid-gref(18413): at Java.Lang.Throwable.SetHandle(IntPtr value, JniHandleOwnership transfer) I/monodroid-gref(18413): at Java.Lang.Throwable..ctor(IntPtr handle, JniHandleOwnership transfer) I/monodroid-gref(18413): at Java.Lang.Error..ctor(IntPtr javaReference, JniHandleOwnership transfer) I/monodroid-gref(18413): at Java.Lang.LinkageError..ctor(IntPtr javaReference, JniHandleOwnership transfer) I/monodroid-gref(18413): at Java.Lang.NoClassDefFoundError..ctor(IntPtr javaReference, JniHandleOwnership transfer) I/monodroid-gref(18413): at System.Reflection.MonoCMethod.Invoke(System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) I/monodroid-gref(18413): at System.Reflection.MonoCMethod.Invoke(BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) I/monodroid-gref(18413): at System.Reflection.ConstructorInfo.Invoke(System.Object[] p I/monodroid-gref(18413): handle 0x40015158; key_handle 0x40015158: Java Type: `java/lang/NoClassDefFoundError`; MCW type: `Java.Lang.NoClassDefFoundError` --------------------- Secondly, I have a recurring allocation that seems to be freed during GC, but then gets 'resurrected' in a second phase. It seems to be related to a weak reference, but again it doesn't give me much to go on other than it seems to be a string. ----------------------- I/monodroid-gref(20680): +g+ grefc 288 gwrefc 0 obj-handle 0x405557a0/L -> new-handle 0x405557a0/L from at Java.Lang.Object.RegisterInstance(IJavaObject instance, IntPtr value, JniHandleOwnership transfer) I/monodroid-gref(20680): at Java.Lang.Object.SetHandle(IntPtr value, JniHandleOwnership transfer) I/monodroid-gref(20680): at Java.Lang.Object..ctor(IntPtr handle, JniHandleOwnership transfer) I/monodroid-gref(20680): at Java.Lang.String..ctor(IntPtr javaReference, JniHandleOwnership transfer) I/monodroid-gref(20680): at System.Reflection.MonoCMethod.Invoke(System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) I/monodroid-gref(20680): at System.Reflection.MonoCMethod.Invoke(BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) I/monodroid-gref(20680): at System.Reflection.ConstructorInfo.Invoke(System.Object[] parameters) I/monodroid-gref(20680): at Android.Runtime.TypeManager.CreateProxy(System.Type type, IntPtr handle, JniHandleOwnership transfer) I/monodroid-gref(20680): at Android.Runtime.TypeManager.CreateInstance(IntPtr handle, Jn I/monodroid-gref(20680): handle 0x405557a0; key_handle 0x405557a0: Java Type: `java/lang/String`; MCW type: `Java.Lang.String` ... I/monodroid-gref(20680): -g- grefc 267 gwrefc 23 handle 0x40553428/G from take_weak_global_ref_jni I/monodroid-gref(20680): *take_weak obj=0x51503cb0 -> wref=0xde5a99d7 handle=0x405557a0 I/monodroid-gref(20680): +w+ grefc 267 gwrefc 24 obj-handle 0x405557a0/G -> new-handle 0xde5a99d7/W from take_weak_global_ref_jni ... I/monodroid-gref(20680): *try_take_global obj=0x51503cb0 -> wref=0xde5a99d7 handle=0x405557a0 I/monodroid-gref(20680): +g+ grefc 248 gwrefc 24 obj-handle 0xde5a99d7/W -> new-handle 0x405557a0/G from take_global_ref_jni I/monodroid-gref(20680): -w- grefc 248 gwrefc 23 handle 0xde5a99d7/W from take_global_ref_jni ----------------------- I am concerned about both of these since the total reference count seems to continue to go up on each of these, but never goes back down (at least when running for hours). ------------------------------ I have written a tool that I have been using to help track the GRefs. You can download a copy http://www.extrastrength.com/files/GRefMonitor.exe here Hopefully, someone will find it useful. -Mike -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Tracking-GlobalReferences-tp5457139p5457139.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
