asp.net-core - 如何在 Linux 上生成大小合理的 .NET Core 进程内存转储文件?

标签 asp.net-core .net-core coreclr

我正在尝试使用 gcore 生成正在运行的 .net 核心进程的合理大小核心转储,但文件大于 20GB。 该进程是 dotnet wapi.dll,它是使用 dotnet new webapi 创建的空项目的二进制文件。 我认为转储的大小与虚拟内存量有关。

htop

主要问题是如何生成较小的核心转储?

这和我想的(虚拟内存)有关吗?

我应该限制虚拟内存吗?怎么办?

最佳答案

我发现最简单的方法是使用 dotnet 运行时附带的 createdump 实用程序,它与 libcoreclr.so 位于同一目录中。 (thanks to Maoni Stephens)。

使用 createddump 非常简单:

createdump [options] pid
-f, --name - dump path and file name. The pid can be placed in the name with %d. The default is "/tmp/coredump.%d"
-n, --normal - create minidump (default).
-h, --withheap - create minidump with heap.
-t, --triage - create triage minidump.
-u, --full - create full core dump.
-d, --diag - enable diagnostic messages.

Read more about createdump here


另一种选择是使用 dotnet-dump 全局工具,它 you can read about it here .

On Linux, the runtime version must be 3.0 or greater. On Windows, dotnet-dump collect will work with any version of the runtime.

因为我运行的是 v2.2,所以我无法使用这个工具。

关于asp.net-core - 如何在 Linux 上生成大小合理的 .NET Core 进程内存转储文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58213127/

相关文章:

c# - 使用本地 .NET Core 系统库而不是将它们添加到每个包中

asp.net - npm 未包含在 ASP.NET Core Web 应用程序中

c# - 如何获取.Net Core中进程的CPU使用率和虚拟内存?

oracle - VS code 未检测到 Linux Mint 中的 .NET Core 运行时

c# - 依赖注入(inject)抽象库

asp.net - 如何将这两个模型连接到 View 模型中

c# - dotnet core http请求设置源ip

asp.net-core - Publishoptions 递归创建 cshtml 文件

asp.net-core - ServiceProvider 无法解析配置方法中的选项

visual-studio-2015 - DNX beta8-15530 : Could not load file or assembly 'Microsoft.DNX.PackageManager'