* You are viewing the archive for October, 2010

Memory Leak in PanelDragDropTarget

While implementing drag-and-drop grouping for the Silverlight DataGrid I noticed that the PanelDragDropTarget contains a memory leak:

Whenever you add a user control containing a PanelDragDropTarget to a page and then remove the user control from this page, the user control is not properly released.

When you replace the PanelDragDropTarget with another control, e.g. a ListBox, the user control is released.

The root cause of this problem is probably the fact that the base class DropDragTarget attaches some events to the Canvas of the Application.Current which are not removed.

I have created a sample project that demonstrates the problem using the MemoryLeakDetector which … Continue Reading