-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Make in memory assemblies in InteractiveAssemblyLoader can be collected when use scripting #74915
base: main
Are you sure you want to change the base?
Conversation
@dotnet-policy-service agree |
} | ||
|
||
public void Dispose() | ||
{ | ||
// This field reference loaded assemblies, so it must be cleared before the loader is disposed. | ||
// Otherwise, AssemblyLoadContext.Unload in CoreAssemblyLoaderImpl would not working | ||
_loadedAssembliesBySimpleName.Clear(); |
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.
I didn't find any place to invoke this Dispose
method in roslyn repo, I don't sure it's safe or suitable to clear _loadedAssembliesBySimpleName
, But in my test case i don't see any negative behavior
…ctor and make inmemory LoadContext collectible default
Anyone can review it? |
Curious to whether this is still applicable? Running into the problem of assemblies hanging around in memory on the latest branch of ros, this seems like a solid solution to me. Hope it gets bumped for review! |
Could you please let me know if this fix is working and is available? We’re experiencing a production issue. |
See #31751 and #41722
Add
isCollectible
parameter toInteractiveAssemblyLoader
makes collecting assemblies that in memory possible.My test code:
Test result:
You can see memory usage and process handle count is steady.
But same test code(without
isCollectible
parameter) useMicrosoft.CodeAnalysis.CSharp.Scripting
4.12.0-1.final package: