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?

More than 5 years have passed since last update.

[C#][.NET] オブジェクトの世代別ガベージコレクションでの世代番号を確認する

Posted at

デバッグ用途にオブジェクトのGCでの管理されている世代を確認したいときのメモ

方法

System.GC.GetGeneration(Object) を使用する。

使用例

使用例
var hoge = new Hoge();

Debug.WriteLine("{0}: GC Generation {1}", "Hoge", GC.GetGeneration(hoge));

関連

[C#][.NET] ガベージコレクタ/ガベージコレクション(GC)に関するまとめ - Qiita

参考

GC.GetGeneration メソッド (System)
GC.Collect() は使い過ぎに注意です!と思って記事かいてみた - 都内で働くSEの技術的なひとりごと

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?