[crossgen2] Fix memory leak in _corInfoImpls. (#49764)
authort-mustafin <66252296+t-mustafin@users.noreply.github.com>
Fri, 19 Mar 2021 18:32:58 +0000 (21:32 +0300)
committerGitHub <noreply@github.com>
Fri, 19 Mar 2021 18:32:58 +0000 (11:32 -0700)
commitfc80be14c3d220b5c283d04b747f9a69a8d42ccb
tree3ed5cd8408d369435c26329d355d5e7f83ab2ca9
parent89eece22f11007568df213254a1667753bff5eb3
[crossgen2] Fix memory leak in _corInfoImpls. (#49764)

* [crossgen2] Implement Dispose in Compilation.

_corInfoImpls elements keeps _compilation reference which keeps reference to whole table _corInfoImpls. The circular referene together with issue #12255 potentionally leads to memory leak in crossgen2 if that table is created more than once. Dispose() method clears the table and prevents memory leak.

Signed-off-by: Timur Mustafin <t.mustafin@partner.samsung.com>
* Update src/coreclr/tools/aot/crossgen2/Program.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs
src/coreclr/tools/aot/crossgen2/Program.cs