-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
Area-InteractiveConcept-Design DebtEngineering Debt, Design Debt, or poor product code qualityEngineering Debt, Design Debt, or poor product code qualityInteractive-ScriptingLogic
Milestone
Description
Using the following code:
while(true)
{
await Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScript.EvaluateAsync("4 + 8");
System.Console.WriteLine($"Loaded assemblies: {System AppDomain.CurrentDomain.GetAssemblies().Count()}");
}
Output:
Loaded assemblies: 49
Loaded assemblies: 50
Loaded assemblies: 51
Loaded assemblies: 52
Loaded assemblies: 53
Loaded assemblies: 54
...
The scripting API generates a new assembly for every call that does not get unloaded, resulting in an ever-increasing number of loaded assemblies and thus in an increasing amount of memory consumption.
There does not appear to be a way to unload the generated assemblies since they are not collectible (How to use and debug assembly unloadability in .NET Core).
How can we unload these generated assemblies?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-InteractiveConcept-Design DebtEngineering Debt, Design Debt, or poor product code qualityEngineering Debt, Design Debt, or poor product code qualityInteractive-ScriptingLogic