【C#】パフォーマンスプロファイラー(メモリ)
Visual Studioのパフォーマンスプロファイラー(メモリ)は、アプリケーションのメモリ使用量を診断し、最適化するために使用されます。このツールを使用することで、メモリリークや過剰なメモリ使用が発生している場所を特定し、アプリケーションのパフォーマンスを向上させることができます。以下は、Visual Studioのメモリプロファイラーの基本的な使用方法について説明します。
テストコード
Playerクラスのリストを増加させて評価してみます
AddList();
void AddList()
{
List<Player> list = new List<Player>();
for (int i = 0; i < 5000; i++)
{
list.Add(new Player());
}
Console.WriteLine();
for (int i = 0; i < 5000; i++)
{
list.Add(new Player());
}
Console.WriteLine();
list.Clear();
Console.WriteLine();
Console.ReadLine();
}
class Player
{
public string Name;
}
ブレークポイントの登録
確認したい要所要所にブレークポイントを登録します

実行後、確認
デバッグありで実行し、ブレークポイントで停止するたびにスナップショットを撮ります

ディスカッション
コメント一覧
まだ、コメントがありません