Skip to content
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

When I use ScriptCompiler compile and run, memory usage not released #747

Closed
Cricle opened this issue Dec 1, 2023 · 3 comments
Closed

Comments

@Cricle
Copy link

Cricle commented Dec 1, 2023

The memory took large and no released, my usage is that the process continues to exist but continuously compiles and executes scripts.

When I use dotnet-script command in powershell, run 1+1 many many times, will be memroy leak.

@filipw
Copy link
Member

filipw commented Dec 1, 2023

This is expected. The assemblies can only be collected if you mark ScriptAssemblyLoadContext as collectible

@Cricle
Copy link
Author

Cricle commented Dec 4, 2023

But I use

var loader = new ScriptAssemblyLoadContext(Guid.NewGuid().ToString("N"),true);
var compiler = new ScriptCompiler(logFactory, !options.NoCache)
{
    AssemblyLoadContext = loader
};

Call loader.Unload() after run. But the memory also not released.

@Cricle Cricle closed this as completed Dec 11, 2023
@Cricle
Copy link
Author

Cricle commented Dec 11, 2023

It was ok!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants