Repository navigation
Closed
Labels
Area: App RuntimeIssues in `libmonodroid.so`.Area: PerformanceIssues with performance.enhancementProposed change to current functionality.possibly-staleIssues that are potentially no longer relevant.
Description
Currently, the Java Callable Wrappers use an ArrayList and methods to help mirror the object graph from the Mono GC to the Android GC:
/* partial */ class Example {
ArrayList<Object> managedReferences = new ArrayList<Object>();
public void monodroidAddReference (Object o) {
managedReferences.add (o);
}
public void monodroidClearReferences () {
managedReferences.clear ();
}
}monodroidAddReference() and monodroidClearReferences() are called via JNI within osbridge.cc:
An idea occurred to me: what if instead of invoking monodroidAddReference()/etc., we instead used a field?
/* partial */ class Example {
Object []managedReferences;
}This would reduce Java-side memory allocations (no ArrayList<Object>), and would alter the number of JNI invocations needed, from num_xrefs JNIEnv::CallVoidMethod() invocations to num_xrefs calls to JNIEnv::SetObjectArrayElement() + 1 JNIEnv::SetObjectField(). (Presumably JNIEnv::SetObjectArrayElement() will be faster than JNIEnv::CallVoidMethod().)
Metadata
Metadata
Assignees
Labels
Area: App RuntimeIssues in `libmonodroid.so`.Area: PerformanceIssues with performance.enhancementProposed change to current functionality.possibly-staleIssues that are potentially no longer relevant.
Activity
dotnet-policy-service commentedon May 8, 2026
We suspect this issue is stale and no longer relevant. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
dotnet-policy-service commentedon May 22, 2026
This issue will now be closed since it had been marked "possibly-stale" but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.