0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

C#でメモリダンプを覗く方法の覚書

Posted at

そのうち必要にせまられt清書します。

ダンプの取り方

dotnet-dump collect を使う
https://learn.microsoft.com/ja-jp/dotnet/core/diagnostics/dotnet-dump#dotnet-dump-collect

  1. サーバー等のシェルに入る
  2. プロセス番号を取得
    • dotnet-dump ps
  3. ダンプファイル置き場を作成する
    • mkdir /tmp/memory みたいな書き込み権限のあるディレクトリ
  4. ダンプを取る
    • dotnet-dump collect -p 1 -o /tmp/memory/$(date "+%Y%m%d%H%M%S").dump
    • 複数回取ることもあるので date を入れている
  5. シェルから出てファイルをローカルに取ってくる

ダンプファイルの解析

dotnet-dump analyze を使う
https://learn.microsoft.com/ja-jp/dotnet/core/diagnostics/dotnet-dump#dotnet-dump-analyze

コールスタックの状態を見る (pstacks)

dotnet-dump analyze path/to/file.dump -c pstacks

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?