From 1460b0c22d9aa243024e7da380333928ba96a76a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Feb 2026 18:32:27 +0000 Subject: [PATCH 1/3] Initial plan From 59ad3518012e0ddf4b4e3833eebf0f6f7d3df9b2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 23:43:40 +0000 Subject: [PATCH 2/3] Fix GC live lock: add WaitForPendingFinalizers before GC.Collect when GRef threshold is reached Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com> --- src/Mono.Android/Android.Runtime/AndroidRuntime.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Mono.Android/Android.Runtime/AndroidRuntime.cs b/src/Mono.Android/Android.Runtime/AndroidRuntime.cs index a594902af07..5ddf3392373 100644 --- a/src/Mono.Android/Android.Runtime/AndroidRuntime.cs +++ b/src/Mono.Android/Android.Runtime/AndroidRuntime.cs @@ -187,6 +187,7 @@ public override JniObjectReference CreateGlobalReference (JniObjectReference val int gc = RuntimeNativeMethods._monodroid_gref_log_new (value.Handle, ctype, r.Handle, ntype, tname, tid, from, 1); if (gc >= JNIEnvInit.gref_gc_threshold) { Logger.Log (LogLevel.Warn, "monodroid-gc", gc + " outstanding GREFs. Performing a full GC!"); + GC.WaitForPendingFinalizers (); System.GC.Collect (); } From 884fbc9c6ba9896e773a91d35d91a1beaa9fa5d8 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 10 Mar 2026 12:27:20 -0500 Subject: [PATCH 3/3] Update src/Mono.Android/Android.Runtime/AndroidRuntime.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/Mono.Android/Android.Runtime/AndroidRuntime.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mono.Android/Android.Runtime/AndroidRuntime.cs b/src/Mono.Android/Android.Runtime/AndroidRuntime.cs index 5ddf3392373..6561e2b8fbd 100644 --- a/src/Mono.Android/Android.Runtime/AndroidRuntime.cs +++ b/src/Mono.Android/Android.Runtime/AndroidRuntime.cs @@ -187,7 +187,7 @@ public override JniObjectReference CreateGlobalReference (JniObjectReference val int gc = RuntimeNativeMethods._monodroid_gref_log_new (value.Handle, ctype, r.Handle, ntype, tname, tid, from, 1); if (gc >= JNIEnvInit.gref_gc_threshold) { Logger.Log (LogLevel.Warn, "monodroid-gc", gc + " outstanding GREFs. Performing a full GC!"); - GC.WaitForPendingFinalizers (); + System.GC.WaitForPendingFinalizers (); System.GC.Collect (); }