Reputation: 1942
I'm trying to generate a reasonably sized core dump of a running .net core process using gcore
, but the file is larger than 20GB.
The process is dotnet wapi.dll
which is the binary of an empty project created using dotnet new webapi
.
I think size of the dump is related to amount of virtual memory.
The main question is how can I generate a smaller core dump?
Is this related to what I'm thinking of (virtual memory)?
Should I limit the virtual memory? how?
Upvotes: 3
Views: 3119
Reputation: 1942
I found the easiest way to do this is to use createdump
utility which comes with dotnet runtime and is located in the same directory as libcoreclr.so. (thanks to Maoni Stephens).
Using createdump
is pretty easy:
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
Another option is to use dotnet-dump global tool which 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.
Because I was running v2.2 then I was unable to use this tool.
Upvotes: 5
Reputation: 15223
Have you tried dotnet-dump
and friends? They support mini
dumps, which are smaller and may be enough for what you need:
$ dotnet tool install -g dotnet-dump
You can invoke the tool using the following command: dotnet-dump
Tool 'dotnet-dump' (version '3.0.47001') was successfully installed.
$ dotnet dump collect --help
collect:
Capture dumps from a process
Usage:
dotnet-dump collect [options]
Options:
--type <Heap|Mini> The dump type determines the kinds of information that are collected from the process. There are two types: heap - A large and relatively comprehensive dump containing module lists, thread lists, all
stacks, exception information, handle information, and all memory except for mapped images. mini - A small dump containing module lists, thread lists, exception information and all stacks. If not
specified 'heap' is the default.
Upvotes: 2