This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Disclaimer: I don't have a ton of experience with memory leaks in .NET. That said, SciTech's Memory Profiler shows my TreeView as the root path for my view models which are no longer in my ItemsSource, via the TreeViewAutomationPeer and TreeViewDataItemAutomationPeer. I'm looking into other references, but I was curious if you could comment on this. I've seen a number of other posts on different forums about people fixing memory leakes by overriding their automation peer to null. Thank you. |
|
|
Hmm, we don't do anything with AutomationPeer, so if there is a general issue with AutomationPeer and memory leaks then we will probably fall victim to it. You could try implementing the 'override to null' technique yourself by deriving your own class from MultiColumnTreeView solely for that purpose. If you also suspect tree view items of being leaky, you would probably also need to derive a class from MultiColumnTreeViewItem and override MultiColumnTreeViewItem.GetContainerFromItemOverride to return your derived type, e.g. protected override DependencyObject GetContainerForItemOverride() |
|
|
Thanks, that should at minimum, let me remove the blame from MulticolumnTreeView. Will try that shortly. |
|
|
I don't really understand why, since I assume the WPF datagrid uses automation, and I have a different MulticolumnTreeView that doesn't leak, but that did it. Thanks. Here's the code to save someone else 3 minutes typing.
class NoAutomationMulticolumnTreeView: MulticolumnTreeView { protected override AutomationPeer OnCreateAutomationPeer() { return null; } protected override DependencyObject GetContainerForItemOverride() { return new NoAutomationMulticolumnTreeViewItem(); } } class NoAutomationMulticolumnTreeViewItem : MulticolumnTreeViewItem { protected override AutomationPeer OnCreateAutomationPeer() { return null; } }
|
|