none
Memory Leak in ScrollViewer control

    Question

  •  Hi,

    I have detected a new memory leak problem using the ScrollViewer control.

    I have three Pages. The MainPage contains a ContentControl where the other two pages will be loaded. The second page contains a control (for example a calendar), and the third page (and last) contains this XAML code:
       <Grid x:Name="LayoutRoot">
    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
    <StackPanel Orientation="Vertical">
    <TextBlock Text="test" Height="50" />
    <TextBlock Text="test" Height="50" />
    <!-- ... 97 times more ... -->
    <TextBlock Text="test" Height="50" />
    </StackPanel>
    </ScrollViewer>

    </Grid>

      

    If the previous page is loaded, and later the calendar page is loaded, and finally the Garbage Collector is forced several times, then all controls and page are removed from memory.

    But if the previous page is loaded, the scrollbar is moved at bottom page, later the calendar page is loaded, and Garbage Collector is forced several times, then the controls and page are not deallocated from memory, producing a memory leak. I have checked with WinDbg.

    I think this problem is related with this one:  http://forums.silverlight.net/forums/t/179358.aspx

     

    Greetings.  

    Thursday, May 06, 2010 2:49 AM