Posted 15 years ago
by Craig
-
Varigence, Inc.
Version: 10.1.0521
Platform: .NET 4.0
Environment: Windows 7 (32-bit)
Using the ANTS memory profiler, I'm seeing a memory leak being caused by the property grid. I believe the simplified scenario is as follows:
1. Have an application with a TreeView (in our case, our TreeView is populated with ViewModels via HierarchicalDataTemplates).
2. Have a property grid (in a ToolWindow) whose SelectedObject binding is:3. Run the application in a memory profiler (in my case, ANTS)
4. Close the tool window and you'll see the following references lingering:
One originates from the ReflectTypeDescriptionProvider._propertyCache. It has a HashTable that contains a PropertyDescriptor array. The array itself contains ReflectPropertyDescriptor objects, one of which has a valueChangedHandler which ends up referencing the last item that appeared in the property grid.
The other is similar but comes from TypeDescriptor._providerTable and has a longer reference path, but still ends up pointing to a ReflectPropertyDescriptor whose valueChangedHandler ends up reference the last item to appear in the property grid.
When I remove the property grid from my application, I don't see any of these lingering references so I'm pretty convinced the grid is responsible. I wonder if this issue is related to this problem: http://support.microsoft.com/kb/938416/en-us
Please let me know if you need more information. Thanks,
-Craig
1. Have an application with a TreeView (in our case, our TreeView is populated with ViewModels via HierarchicalDataTemplates).
2. Have a property grid (in a ToolWindow) whose SelectedObject binding is:
SelectedObject="{Binding ElementName=treeView, Path=SelectedItem, Mode=OneWay}"
4. Close the tool window and you'll see the following references lingering:
One originates from the ReflectTypeDescriptionProvider._propertyCache. It has a HashTable that contains a PropertyDescriptor array. The array itself contains ReflectPropertyDescriptor objects, one of which has a valueChangedHandler which ends up referencing the last item that appeared in the property grid.
The other is similar but comes from TypeDescriptor._providerTable and has a longer reference path, but still ends up pointing to a ReflectPropertyDescriptor whose valueChangedHandler ends up reference the last item to appear in the property grid.
When I remove the property grid from my application, I don't see any of these lingering references so I'm pretty convinced the grid is responsible. I wonder if this issue is related to this problem: http://support.microsoft.com/kb/938416/en-us
Please let me know if you need more information. Thanks,
-Craig