Repository navigation
[native, Mono.Android] Remove WeakReference support - #9454
Merged
Merged
Conversation
jonpryor
force-pushed
the
dev/jonp/jonp-remove-weak_handle
branch
from
October 23, 2024 17:54
8aa4bd0 to
6b24700
Compare
Context: https://github.com/dotnet/java-interop/issues/1255 Context: https://github.com/xamarin/monodroid/commit/a5c52905293d7eecdb3c078da62100081b338045 Context: https://issuetracker.google.com/issues/36986478 Context: https://github.com/dotnet/android/blob/b56d68fe2a2c2dffa47eb7e41ae08a00fda86367/Documentation/workflow/SystemProperties.md#debugmonowref Android did not support [JNI Weak Global References][0] until API-8 (Android 2.2). To allow Mono for Android applications to run on API-7 and earlier devices, while using JNI Weak Global References when possible (fewer GC allocations, better performance), the GC bridge supported two modes of operation: * `debug.mono.wref=jni`: Use JNI Weak Global References. * `debug.mono.wref=java`: Use [`java.lang.ref.WeakReference`][1]. With the exception of a ["minor" (lol) issue][2] in KitKat v4.4.2 (API-19) -- in which `JNIEnv::NewGlobalRef()` around a collected JNI Weak Global Reference would return a non-`NULL` value, which would result in app crashes; xamarin/monodroid@a5c52905 added a workaround to use the `WeakReference` backend on Android 4.4.2 -- the `debug.mono.wref=java` backend has not been used since *2014*. Apps *could* use [`@(AndroidEnvironment)`][3] to set `debug.mono.wref=java`, but there is no reason to do so (worse performance!), [nor has anyone done so on GitHub.com][4] (no matches for `debug.mono.wref` within files that would be used with `@(AndroidEnvironment)`). Cleanup src/native and src/Mono.Android, and *remove* support for the `debug.mono.wref=java` backend. [0]: https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/functions.html#weak_global_references [1]: https://developer.android.com/reference/java/lang/ref/WeakReference [2]: https://issuetracker.google.com/issues/36986478 [3]: https://learn.microsoft.com/dotnet/android/building-apps/build-items#androidenvironment [4]: https://github.com/search?type=code&q=debug.mono.wref
jonpryor
force-pushed
the
dev/jonp/jonp-remove-weak_handle
branch
from
October 23, 2024 18:14
6b24700 to
55632c3
Compare
grendello
approved these changes
Oct 23, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context: #11854
Context: https://github.com/xamarin/monodroid/commit/a5c52905293d7eecdb3c078da62100081b338045
Context: https://issuetracker.google.com/issues/36986478
Context: https://github.com/dotnet/android/blob/b56d68fe2a2c2dffa47eb7e41ae08a00fda86367/Documentation/workflow/SystemProperties.md#debugmonowref
Android did not support JNI Weak Global References until API-8 (Android 2.2). To allow Mono for Android applications to run on API-7 and earlier devices, while using JNI Weak Global References when possible (fewer GC allocations, better performance), the GC bridge supported two modes of operation:
debug.mono.wref=jni: Use JNI Weak Global References.debug.mono.wref=java: Usejava.lang.ref.WeakReference.With the exception of a "minor" (lol) issue in KitKat v4.4.2 (API-19) -- in which
JNIEnv::NewGlobalRef()around a collected JNI Weak Global Reference would return a non-NULLvalue, which would result in app crashes; xamarin/monodroid@a5c52905 added a workaround to use theWeakReferencebackend on Android 4.4.2 -- thedebug.mono.wref=javabackend has not been used since 2014.Apps could use
@(AndroidEnvironment)to setdebug.mono.wref=java, but there is no reason to do so (worse performance!), nor has anyone done so on GitHub.com (no matches fordebug.mono.wrefwithin files that would be used with@(AndroidEnvironment)).Cleanup src/native and src/Mono.Android, and remove support for the
debug.mono.wref=javabackend.