大きなアプリケーションでメモリリークをデバッグしようとしています。私の第一歩はWinDBGに慣れ親しむことです。私は、.NETで次のプログラムを持っている:私は「HelloWorldの」あるべきWinDbgのでHelloWorldの変数の内容を表示しようとしています.NET - WinDBG - 文字列の内容
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim HelloWorld As String = "HelloWorld"
Dim testInt As Integer
Me.Show()
For testInt = 0 To 1000000
TextBox1.Text = testInt 'There is a textbox on the form
Application.DoEvents() 'So textbox updates on the fly
Next
Catch ex As Exception
End Try
End Sub
。私はこれらの指示に従いました:
1)実行可能にWinDBGを添付し、デバッガを起動します。
2)ループが終了する前に
3)loadby SOS CLR
4)(すぐブレーク)〜0
5)!clrstack
6)!dumpheap型WinDBGの(プロジェクトはWinDBGApplicationと呼ばれる)
出力はこれです:
Statistics:
MT Count TotalSize Class Name
00186f88 1 12 WinDBGTest.My.MyProject+ThreadSafeObjectProvider`1[[WinDBGTest.My.MyProject+MyWebServices, WinDBGTest]]
00186e80 1 12 WinDBGTest.My.MyProject+ThreadSafeObjectProvider`1[[WinDBGTest.My.MyProject+MyForms, WinDBGTest]]
00186e2c 1 12 WinDBGTest.My.MyProject+MyForms
00186d3c 1 12 WinDBGTest.My.MyProject+ThreadSafeObjectProvider`1[[Microsoft.VisualBasic.ApplicationServices.User, Microsoft.VisualBasic]]
00186cec 1 12 WinDBGTest.My.MyProject+ThreadSafeObjectProvider`1[[WinDBGTest.My.MyComputer, WinDBGTest]]
00186be8 1 12 WinDBGTest.My.MyProject+ThreadSafeObjectProvider`1[[WinDBGTest.My.MyApplication, WinDBGTest]]
00184bf4 1 104 WinDBGTest.My.MyApplication
00187308 1 328 WinDBGTest.Form1
Total 8 objects
HelloWorldという文字列の証拠はなく、低レベルのデバッグに関する限られた知識に基づいているはずです。私は間違って何をしていますか?
私はRockstartによって提案されたものをしようと、この出力を取得しています
OS Thread Id: 0x7a0 (0)
ESP/REG Object Name
0039E5EC 0234db94 System.Windows.Forms.Control+ControlNativeWindow
0039E63C 0234dadc System.Windows.Forms.TextBox
0039E658 0234dadc System.Windows.Forms.TextBox
0039E668 0234dadc System.Windows.Forms.TextBox
0039E680 0234db94 System.Windows.Forms.Control+ControlNativeWindow
0039E698 0234db94 System.Windows.Forms.Control+ControlNativeWindow
0039E6A8 0234db94 System.Windows.Forms.Control+ControlNativeWindow
0039E7FC 0234dadc System.Windows.Forms.TextBox
0039E864 02604b10 System.Windows.Forms.Control+MultithreadSafeCallScope
0039E868 02604b68 System.String 26309
0039E878 026049a8 System.String 26310
0039E87C 0234dadc System.Windows.Forms.TextBox
0039E880 026049a8 System.String 26310
0039E884 0234db94 System.Windows.Forms.Control+ControlNativeWindow
0039E890 0234db94 System.Windows.Forms.Control+ControlNativeWindow
0039E8A0 026049a8 System.String 26310
0039E8AC 0234dadc System.Windows.Forms.TextBox
0039E8B4 0234db84 System.Windows.Forms.PropertyStore
0039E8C8 0234dadc System.Windows.Forms.TextBox
0039E8CC 026049a8 System.String 26310
0039E8DC 026049a8 System.String 26310
0039E8E0 0234dadc System.Windows.Forms.TextBox
0039E8EC 0234dadc System.Windows.Forms.TextBox
0039E8F0 0234dadc System.Windows.Forms.TextBox
0039E904 0234d4e4 WinDBGTest.Form1
0039E940 0234d4e4 WinDBGTest.Form1
0039E944 0234e4c0 System.EventHandler
0039E970 0234a1c4 System.EventArgs
0039E978 0234d4e4 WinDBGTest.Form1
0039E9DC 0234d4e4 WinDBGTest.Form1
0039EA00 0234d4e4 WinDBGTest.Form1
0039EAE0 0234d984 System.Windows.Forms.Control+ControlNativeWindow
0039ED28 0234d4e4 WinDBGTest.Form1
0039ED34 0234d4e4 WinDBGTest.Form1
0039ED3C 0234d4e4 WinDBGTest.Form1
0039ED44 0234d4e4 WinDBGTest.Form1
0039ED4C 0234d4e4 WinDBGTest.Form1
0039EDCC 0234d4e4 WinDBGTest.Form1
0039EE18 023491c8 System.Windows.Forms.Application+ThreadContext
0039EE58 023490c8 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase+WinFormsAppContext
0039EE8C 02348f54 WinDBGTest.My.MyApplication
0039EEA8 02348f54 WinDBGTest.My.MyApplication
0039EEB8 02348f54 WinDBGTest.My.MyApplication
0039F1D8 02348640 System.Object[] (System.String[])
これは完全に不可能ではありませんが、windbgはリークのトラブルシューティングにはかなり泥だらけのツールです。データの山に溺れないようにするのに役立つのはほんのわずかですが、ノイズと信号の比は非常に貧弱です。代わりに.NETメモリプロファイラを使用してください。 –
私は同意しますが、WinDbgは無料です。この文字列の内容を見ることができるコマンドを知っていますか? – w0051977