1、使用性能调试工具:CLRProfiler(免费)、.NET.Memory.Profiler。分析对象的创建、回收,分析内存泄露的原因。
2、使用CLRProfiler看下面的代码观察GC的情况,TimerLine。
for (int i=0;i<1000 ;i++ ){List<Person> list = new List<Person>();for (int j = 0; j < 1000; j++){list.Add(new Person());}Thread.Sleep(10);}
3、WinDbg 成为牛人必备的工具。