.NET Core 3.1 中的工作站 GC 不适用于 AWS Lambda

Ama*_*tur 5 garbage-collection amazon-web-services .net-core aws-lambda

我正在使用 .NET Core 3.1 创建 AWS Lambda 函数,但遇到内存消耗增加的问题。因此,我想使用 Workstation GC,因为此设置可减少数倍的内存消耗。

我在 *.csproj 文件中将ServerGarbageCollection设置设置为false :

<PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AWSProjectType>Lambda</AWSProjectType>
    <!-- This property makes the build directory similar to a publish directory and helps the AWS .NET Lambda Mock Test Tool find project dependencies. -->
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
    <ServerGarbageCollection>false</ServerGarbageCollection>
  </PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

在 * .runtimeconfig.json中构建项目后,已添加这些行

"configProperties": {
      "System.GC.Server": false
    }
Run Code Online (Sandbox Code Playgroud)

进行这些更改后,在检查垃圾收集器模式时,GCSettings.IsServerGC属性始终为true

我在常规控制台应用程序上对其进行了测试,它工作正常,但是一旦我连接了 aws lambda 库,该应用程序就变得像一个类库,并且无法更改此设置。我搜索了 aws 文档,但没有找到任何可以帮助我的内容。

问:如何在 AWS Lambda 中启用工作站 GC?