我正在尝试使用 gcore
生成正在运行的 .net 核心进程的合理大小核心转储,但文件大于 20GB。
该进程是 dotnet wapi.dll
,它是使用 dotnet new webapi
创建的空项目的二进制文件。
我认为转储的大小与虚拟内存量有关。
主要问题是如何生成较小的核心转储?
这和我想的(虚拟内存)有关吗?
我应该限制虚拟内存吗?怎么办?
最佳答案
我发现最简单的方法是使用 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/