-
Notifications
You must be signed in to change notification settings - Fork 9
Destroy all generic instances when module is unloaded #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Destroy all generic instances when module is unloaded #286
Conversation
Is this a change that upstream would be interested in? |
I believe so, I'll make an issue to discuss it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, but really deferring to upstream issue discussion and resolution.
created an upstream issue with a reproproject - dotnet#114068 |
e4d3ed3
to
f1969bc
Compare
f1969bc
to
dd1a231
Compare
@UnityAlex @joncham the PR should now match dotnet#114107 which is merged to upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for upstreaming this!
ClassUnloadStarted
andClassUnloadFinished
profiler api callbacks are not called for generic instances which are allocated under a different loader allocator. That:Notify
logic which is done at class loading time - https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/clsload.cpp#L2617The suggested change makes
Destruct
to be called for all classes.There is a potential sideeffect as
EEClass:Destruct
when 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.