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

[crossgen2] Fix memory leak in _corInfoImpls. #49764

Merged
merged 2 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace ILCompiler
{
public abstract class Compilation : ICompilation
public abstract class Compilation : ICompilation, IDisposable
{
protected readonly DependencyAnalyzerBase<NodeFactory> _dependencyGraph;
protected readonly NodeFactory _nodeFactory;
Expand Down Expand Up @@ -67,6 +67,7 @@ protected Compilation(
_methodILCache = new ILCache(ilProvider, NodeFactory.CompilationModuleGroup);
}

public abstract void Dispose();
public abstract void Compile(string outputFileName);
public abstract void WriteDependencyLog(string outputFileName);

Expand Down Expand Up @@ -218,6 +219,7 @@ public interface ICompilation
{
void Compile(string outputFileName);
void WriteDependencyLog(string outputFileName);
void Dispose();
}

public sealed class ReadyToRunCodegenCompilation : Compilation
Expand Down Expand Up @@ -638,5 +640,10 @@ protected override void ComputeDependencyNodeDependencies(List<DependencyNodeCor
}

public ISymbolNode GetFieldRvaData(FieldDesc field) => NodeFactory.CopiedFieldRva(field);

public override void Dispose()
{
_corInfoImpls?.Clear();
}
}
}
1 change: 1 addition & 0 deletions src/coreclr/tools/aot/crossgen2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ private int Run(string[] args)

if (_commandLineOptions.DgmlLogFileName != null)
compilation.WriteDependencyLog(_commandLineOptions.DgmlLogFileName);
compilation.Dispose();
jkotas marked this conversation as resolved.
Show resolved Hide resolved
}

return 0;
Expand Down