Memory leak problem in Thumb control
-
Monday, May 10, 2010 6:09 AM
I think I have detected a new problem with memory leak in Silverlight 4. Now, this new problem has been detected in Thumb control.
I have created a new Silverlight 4 application with three pages:
- MainPage: With a content control, and three buttons. The first button load the Page1 in the content control. The second button load the Page 2 in the content control. And the last button will call ten times to GC.Collect() and GC.WaitForPendingFinalizers().
- Page1: Empty page.
- Page2:
XAML:<Grid x:Name="LayoutRoot" Background="Pink" Width="400" Height="400">
<Thumb x:Name="myThumbStart"
Grid.Row="0"
Height="50"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Width="50"
DragDelta="myThumbStart_DragDelta"
>
</Thumb>
</Grid>
Code behind:public partial class DualSlider3 : UserControl
{
public DualSlider3()
{
InitializeComponent();
}
private void myThumbStart_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
double newMarginLeft = myThumbStart.Margin.Left + e.HorizontalChange;
if ((newMarginLeft >= 0) && (this.LayoutRoot.ActualWidth > (newMarginLeft + myThumbStart.ActualWidth)))
{
myThumbStart.Margin = new Thickness(newMarginLeft, 0, 0, 0);
}
}
}If I load the Page2 and I move the Thumb control doing drag with mouse from left side to right side several times, when I load the Page1 and press GC button, the Page2 (and all its content) is not removed from memory. I checked it with WinDbg.
Can anybody test this problem?

