Destroy all generic instances when module is unloaded - #286
Merged
alexey-zakharov merged 5 commits intoApr 4, 2025
Conversation
Collaborator
|
Is this a change that upstream would be interested in? |
Author
I believe so, I'll make an issue to discuss it |
joncham
approved these changes
Mar 28, 2025
joncham
left a comment
There was a problem hiding this comment.
Approving, but really deferring to upstream issue discussion and resolution.
Author
|
created an upstream issue with a reproproject - dotnet#114068 |
alexey-zakharov
force-pushed
the
fix-classunload-callback-for-generic-instances
branch
from
April 1, 2025 15:29
e4d3ed3 to
f1969bc
Compare
alexey-zakharov
force-pushed
the
fix-classunload-callback-for-generic-instances
branch
from
April 3, 2025 18:29
f1969bc to
dd1a231
Compare
Author
|
@UnityAlex @joncham the PR should now match dotnet#114107 which is merged to upstream |
UnityAlex
approved these changes
Apr 4, 2025
UnityAlex
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for upstreaming this!
alexey-zakharov
deleted the
fix-classunload-callback-for-generic-instances
branch
April 4, 2025 11:22
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ClassUnloadStartedandClassUnloadFinishedprofiler api callbacks are not called for generic instances which are allocated under a different loader allocator. That:Notifylogic which is done at class loading time - https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/clsload.cpp#L2617The suggested change makes
Destructto be called for all classes.There is a potential sideeffect as
EEClass:Destructwhen the class is a delegate type - https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/class.cpp#L124, but if I read the code correctly it should decrement a reference that was added when a delegate instance was created.