0

I try to detect memory leak on my .net core server and make memory dump via gcore. Try to analyze it via lldb and sos on debian 9.

ulimit -c unlimited
sudo gcore -o dump $(pidof dotnet)
sudo lldb-4.0 $(which dotnet) --core ./dump.MY_PID
(lldb) plugin load /usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.1/libsosplugin.so
sos DumpHeap -stat

so, I have big table with mt, count, size and objname

But all my classes is UNKNOWN

...
00007f754af190b8      650        26000 UNKNOWN
00007f754b339df0      512        32768 UNKNOWN
00007f7549e8d718        6        35692 System.UInt16[]
00007f754c4e9e10      679        38024 UNKNOWN
00007f7549eb3138      482        61696 System.IO.FileStream
00007f754a155468      203        74208 System.Collections.Generic.Dictionary`2+Entry[[System.String, System.Private.CoreLib],[System.Int32, System.Private.CoreLib]][]
00007f754af198f8      695        90088 UNKNOWN
00007f7549e910d0      173        90696 System.Object[]
00007f7549e8a790     1010        98996 System.Int32[]
00007f7549e94ef0      361       417304 System.Char[]
00007f7549e950f0     1826       677178 System.Byte[]
00007f7549ea8a20    12844      1046724 System.String
00000000009628b0      809      2671130      Free

I think, that I should set symbols. But... I copy it to CLR folder /usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.1/ and try to use add-dsym command. Nothing change... How can I have normal dump with full stack?

1 Answers1

0

From Microsoft's documentation:

Other tools like gdb or gcore can also be used to create core dumps but may miss state needed for managed debugging, resulting in "UNKNOWN" type or function names during analysis.

createdump is the recommended tool for creating core dumps on Linux containing both native and managed information.

Here is a documentation on downloading the host program, modules and symbols for the core dump.

Additionaly:

Once LLDB starts, it may be necessary to use the setsymbolserver command to point at the correct symbol location (setsymbolserver -ms to use Microsoft's symbol server or setsymbolserver -directory to specify a local path). Native symbols can be loaded by running loadsymbols. At this point, SOS commands can be used to analyze the dump.