Forum Xamarin Xamarin.Android

Enhanced grefs

jhp3jhp3 GBMember

Hi, I am trying to see where grefs are created, as in the example below. But I dont get that - I only get the gref lines.
I have done 'adb shell setprop debug.mono.log gref'.
What do I need to do? Thanks.

    I/monodroid-gref(12405): +g+ grefc 108 gwrefc 0 obj-handle 0x40517468/L -> new-handle 0x40517468/L from    at          Java.Lang.Object.RegisterInstance(IJavaObject instance, IntPtr value, JniHandleOwnership transfer)
    I/monodroid-gref(12405):    at Java.Lang.Object.SetHandle(IntPtr value, JniHandleOwnership transfer)
    I/monodroid-gref(12405):    at Java.Lang.Object..ctor(IntPtr handle, JniHandleOwnership transfer)
    I/monodroid-gref(12405):    at Java.Lang.Thread+RunnableImplementor..ctor(System.Action handler, Boolean removable)
    I/monodroid-gref(12405):    at Java.Lang.Thread+RunnableImplementor..ctor(System.Action handler)
    I/monodroid-gref(12405):    at Android.App.Activity.RunOnUiThread(System.Action action)
    I/monodroid-gref(12405):    at Mono.Samples.Hello.HelloActivity.UseLotsOfMemory(Android.Widget.TextView textview)
    I/monodroid-gref(12405):    at Mono.Samples.Hello.HelloActivity.<OnCreate>m__3(System.Object o)
    I/monodroid-gref(12405): handle 0x40517468; key_handle 0x40517468: Java 


  • jhp3jhp3 GBMember

    What I mean is, I only get the output below. How can I get the extra information? I am running on a real device.
    Can anyone help?

    [monodroid-gref] +g+ grefc 229 gwrefc 0 obj-handle 0x425a31a8/L -> new-handle 0x1d20064e/G from thread '(null)'(1)
    [monodroid-gref] +g+ grefc 230 gwrefc 0 obj-handle 0x425a2cc0/L -> new-handle 0x1d200652/G from thread '(null)'(1)
    [monodroid-gref] +g+ grefc 231 gwrefc 0 obj-handle 0x4274c0f0/L -> new-handle 0x1d200656/G from thread '(null)'(1)
    [monodroid-gref] -g- grefc 231 gwrefc 0 handle 0x1d200656/G from thread '(null)'(1)
    [monodroid-gref] +g+ grefc 231 gwrefc 0 obj-handle 0x42791c28/L -> new-handle 0x1d300656/G from thread '(null)'(1)
    [monodroid-gref] +g+ grefc 232 gwrefc 0 obj-handle 0x42791c50/L -> new-handle 0x1d20065a/G from thread '(null)'(1)

  • AndresBlasPujadasAndresBlasPujadas USMember ✭✭

    @jhp3 Same problem here. Trying to see where the global references are made in order to debug some serious issues that make our app crash quite randomly. App closes due to a native crash like this:

    I/dalvikvm( 4460): JNI ERROR (app bug): accessed deleted global reference 0x20701a0a
    E/dalvikvm( 4460): VM aborting
    F/libc    ( 4460): Fatal signal 6 (SIGABRT) at 0x0000116c (code=-6), thread 8100 (

    But my GREF messages does not output the stacktrace of the reference, it only puts "from thread '(null)'"

  • Mark.0036Mark.0036 USMember

    Just in case anyone else stumbles across this, I had the same problem and found the solution.

    In newer versions of Xamarin.Android, it writes that info to a file instead of sending it all to logcat. It's at the package's files/.override/grefs.txt

Sign In or Register to comment.