dotnet / dotnet/android

Remove empty finalizers from bridge objects

Open
#12,303 0 comments 0 reactions 0 assignees View on GitHub
Area: Performance
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 19h
Merged PRs (30d)
252

Description

Mono required bridge objects to have a finalizer so that they can be iterated during GC. For CoreCLR we use a completely different mechanism, by having explicit gc handles registered for all these objects. This means that, for CoreCLR, finalizers just add unnecessary overhead. I believe we should be able to remove them once mono support is dropped from this repository, probably for .net12.

Example: https://github.com/dotnet/android/blob/main/src/Mono.Android/Java.Lang/Object.cs#L32

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/Mono.Android/Java.Lang/Object.cs and inspect the other bridge objects for finalizers, then trace how CoreCLR registers their explicit GC handles. Confirm the scope is limited to code that no longer needs Mono support and identify existing validation for bridge-object garbage collection before removing the finalizers.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
mobile-dev
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.