Add an option to run ILC with workstation GC (#89836)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Wed, 2 Aug 2023 06:06:53 +0000 (15:06 +0900)
committerGitHub <noreply@github.com>
Wed, 2 Aug 2023 06:06:53 +0000 (15:06 +0900)
This should help fixing "docker killing container due to memory use" woes.

We could consider dropping parallelism at MSBuild level instead, but this has less of a throughput impact.

src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets

index 17463ba..90fda19 100644 (file)
@@ -299,7 +299,12 @@ The .NET Foundation licenses this file to you under the MIT license.
       DependsOnTargets="WriteIlcRspFileForCompilation;$(IlcCompileDependsOn)">
     <Message Text="Generating native code" Importance="high" />
 
-    <Exec Command="&quot;$(IlcToolsPath)\ilc&quot; @&quot;$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).ilc.rsp&quot;" />
+    <PropertyGroup>
+      <_IlcEnvironmentVariables Condition="'$(IlcUseServerGc)' == 'false'">DOTNET_gcServer=0;$(_IlcEnvironmentVariables)</_IlcEnvironmentVariables>
+    </PropertyGroup>
+
+    <Exec Command="&quot;$(IlcToolsPath)\ilc&quot; @&quot;$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).ilc.rsp&quot;"
+          EnvironmentVariables="$(_IlcEnvironmentVariables)" />
 
     <!-- Trick ILLinker into not actually running -->
     <MakeDir Condition="$([MSBuild]::VersionLessThan('$(NETCoreSdkVersion)', '7.0.0'))" Directories="$(IntermediateLinkDir)" />