2011-01-05 11 views
0

Silverlight MVVMアプリケーションでは、Silverlight ToolkitのTimePickerでしばらくの間苦労しています。これを使用すると、TimePickerがガベージコレクションされるビューが停止します。同じビューを5回開いて閉じると、ビューには5つのコピーがメモリに保存されます。MVVMアプリケーションでSilverlightのTimePickersを使用するとメモリリークが発生する

私たちは、MVR_Light:EventToCommandを持つKeyTriggersのメモリリークに関する以前の問題を抱えていました。この問題は、KeyTriggerの名前を使用してコード内のトリガーを切り離すことで解決されました。

WinDbgツールを使用して、ビューを閉じると、View(およびもちろんViewModel)の参照がTimePickerから参照されることがわかります。 この問題を解決するために、特定のTimePickerのKeyTriggerを何らかの方法で切り離すことが可能かどうか、私の質問は今ですか?または、誰かが既にTimePickerの使用経験があった場合、メモリリークを防ぐ別の方法がありますか?

ありがとうございました!

PS:!のSilverlightの

DOMAIN(07E099E8):HANDLE(Pinned):39b12f8:Root: 0bd74260(System.Object[])-> 
    0ad8a2d0(System.Collections.Generic.Dictionary`2[[System.IntPtr, mscorlib],[System.Object, mscorlib]])-> 
    0c0dc6e8(System.Collections.Generic.Dictionary`2+Entry[[System.IntPtr, mscorlib],[System.Object, mscorlib]][])-> 
    0b6fa01c(System.Windows.Controls.Border)-> 
    0b6fa080(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])-> 
     0b6fa0cc(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])-> 
    0b6f985c(System.Windows.Controls.Grid)-> 
    0b6f98c0(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])-> 
    0b6f9f90(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])-> 
    0b6f9564(System.Windows.Controls.ContentControl)-> 
    0b6f97c8(System.Collections.Generic.Dictionary`2[[System.Windows.DependencyProperty, System.Windows],[System.Windows.EffectiveValueEntry, System.Windows]])-> 
    0b6f9814(System.Collections.Generic.Dictionary`2+Entry[[System.Windows.DependencyProperty, System.Windows],[System.Windows.EffectiveValueEntry, System.Windows]][])-> 
    0b6f97b4(MS.Internal.ModifiedValue)-> 
    0b6f9754(System.Windows.TemplateBindingExpression)-> 
    0b6f61a0(System.Windows.Controls.TimeUpDown)-> 
    0b6f874c(System.EventHandler`1[[System.Windows.Controls.UpDownParseErrorEventArgs, System.Windows.Controls.Input.Toolkit]])-> 
    0b49f9b4(System.Windows.Controls.TimePicker)-> 
    0b49fef4(System.Windows.DataContextChangedEventHandler)-> 
    0b49fea0(System.Windows.Data.BindingExpression)-> 
    0b44ff48(MyProject.ViewModel.MyViewModel)-> 
    0b450514(GalaSoft.MvvmLight.Command.RelayCommand`1[[System.String, mscorlib]])-> 
    0b707b1c(System.EventHandler)-> 
    0b4a7f84(GalaSoft.MvvmLight.Command.EventToCommand)-> 
    0b4a7c2c(System.Windows.DOCollection)-> 
    0b4a7bcc(System.Windows.Interactivity.TriggerActionCollection)-> 
    0b4a7b5c(Microsoft.Expression.Interactivity.Input.KeyTrigger)-> 
    0b4a4704(System.Windows.DOCollection)-> 
    0b4a5b8c(System.Collections.Generic.Dictionary`2[[System.Windows.DependencyObject, System.Windows],[System.Object, mscorlib]])-> 
    0b4a84b0(System.Collections.Generic.Dictionary`2+Entry[[System.Windows.DependencyObject, System.Windows],[System.Object, mscorlib]][])-> 
    0b4a7118(Microsoft.Expression.Interactivity.Input.KeyTrigger)-> 
    0b4a732c(System.Collections.Generic.Dictionary`2[[System.Windows.DependencyProperty, System.Windows],[System.Windows.EffectiveValueEntry, System.Windows]])-> 
    0b4a7378(System.Collections.Generic.Dictionary`2+Entry[[System.Windows.DependencyProperty, System.Windows],[System.Windows.EffectiveValueEntry, System.Windows]][])-> 
    0b70f5f4(MS.Internal.ModifiedValue)-> 
    0b4a2eb0(System.Windows.Controls.DataGrid)-> 
    0b7059e4(System.Windows.Controls.ScrollContentPresenter)-> 
    0b705a54(MS.Internal.Controls.ScrollData)-> 
    0b4a2bb8(System.Windows.Controls.ScrollViewer)-> 
    0b49b70c(System.Windows.Controls.Grid)-> 
    0b4a8b50(System.Windows.Controls.Grid)-> 
    0b48ebb0(System.Windows.Controls.Grid)-> 
    0b48ec14(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])-> 
    0b492f3c(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])-> 
    0b49b4b0(System.Windows.Controls.Grid)-> 
    0b49b514(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])-> 
    0b49b560(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])-> 
    0b493a28(System.Windows.Controls.Grid)-> 
    0b4947a8(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])-> 
    0b4aa2f4(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])-> 
    0b498900(System.Windows.Controls.Grid)-> 
    0b49912c(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])-> 
    0b499178(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])-> 
    0b498ad4(System.Windows.Controls.TextBox)-> 
    0b498b58(MS.Internal.CoreTypeEventHelper)-> 
    0b498d20(System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib],[MS.Internal.CoreTypeEventHelper+EventAndDelegate, System.Windows]])-> 
    0b498d6c(System.Collections.Generic.Dictionary`2+Entry[[System.Int32, mscorlib],[MS.Internal.CoreTypeEventHelper+EventAndDelegate, System.Windows]][])-> 
    0b498d10(MS.Internal.CoreTypeEventHelper+EventAndDelegate)-> 
    0b498cd8(System.Windows.Input.KeyEventHandler)-> 
    0ae3cf10(MyProject.Views.MyView) 

答えて

0

のVisual Studio 2010 SP1のサポートプロファイリング:ここでは1つのビューのWinDbgののgcrootコマンドの出力があります。あなたは私たちにこの有益なことができ、それを最大限に活用することができます。

0

Antzメモリプロファイラー(RedGate)を試して、あなたのアプリをプロファイルしてください。なぜそれがメモリに残っているのかを判断するために必要なすべての情報を提供します。イベントハンドラがクリーンアップされない可能性がありますか?

私はプロファイラを使用して非常に多くのメモリリークを解決しました。あなた自身をきれいにする必要があることは素晴らしいことです。

0

KeyTriggerPopupを使用して特別なメモリリークがあり、MSはnot fix it near futureになります。

Windowを使用しても問題は発生しません。

関連する問題