使用SOS.dll调查内存泄露

1.用windbg或者VS加载SOS.dll, 可以参考我的另外一篇“ 如何用Visual Studio集成SOS.dll进行调试 ” 2.  (1)用GCHandleLeaks调查      具体示例如下:

0:003> !gchandleleaks

-------------------------------------------------------------------------------

GCHandleLeaks will report any GCHandles that couldn't be found in memory.     

Strong and Pinned GCHandles are reported at this time. You can safely abort the

memory scan with Control-C or Control-Break.                                  

-------------------------------------------------------------------------------

Found 249 handles:

0000000001dc1200     0000000001dc1208     0000000001dc1210    0000000001dc1218    

0000000001dc1220     0000000001dc1228     0000000001dc1230    0000000001dc1238    

0000000001dc1240     0000000001dc1248     0000000001dc1250    0000000001dc1258    

0000000001dc1260     0000000001dc1268     0000000001dc1270    0000000001dc1278    

0000000001dc1280     0000000001dc1288     0000000001dc1290    0000000001dc1298    

0000000001dc12a0     0000000001dc12a8     0000000001dc12b0    0000000001dc12b8    

使用SOS.dll调查内存泄露

1.用windbg或者VS加载SOS.dll, 可以参考我的另外一篇“ 如何用Visual Studio集成SOS.dll进行调试 ” 2.  (1)用GCHandleLeaks调查      具体示例如下:

0:003> !gchandleleaks

-------------------------------------------------------------------------------

GCHandleLeaks will report any GCHandles that couldn't be found in memory.     

Strong and Pinned GCHandles are reported at this time. You can safely abort the

memory scan with Control-C or Control-Break.                                  

-------------------------------------------------------------------------------

Found 249 handles:

0000000001dc1200     0000000001dc1208     0000000001dc1210    0000000001dc1218    

0000000001dc1220     0000000001dc1228     0000000001dc1230    0000000001dc1238    

0000000001dc1240     0000000001dc1248     0000000001dc1250    0000000001dc1258    

0000000001dc1260     0000000001dc1268     0000000001dc1270    0000000001dc1278    

0000000001dc1280     0000000001dc1288     0000000001dc1290    0000000001dc1298    

0000000001dc12a0     0000000001dc12a8     0000000001dc12b0    0000000001dc12b8