From 201aae91a538e98e9dd16ff18f2752c747f5a000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Thu, 9 Mar 2023 15:13:02 +0900 Subject: [PATCH] Try reducing memory pressure during object writing (#83181) --- .../DependencyAnalysis/ObjectWriter.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs index b42db28d6f244..c5e164c8d914a 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs @@ -1150,7 +1150,20 @@ public static void EmitObject(string objectFilePath, IReadOnlyCollection gcMemoryInfo.TotalAvailableMemoryBytes / 2) + { + if (logger.IsVerbose) + logger.LogMessage($"Freeing up memory"); + + GC.Collect(GC.MaxGeneration, GCCollectionMode.Aggressive); + } objectWriter.EmitDebugModuleInfo(); @@ -1158,6 +1171,9 @@ public static void EmitObject(string objectFilePath, IReadOnlyCollection