13 Answers, 1 is accepted
I am also experiencing this.
I was trying to track down where and it seems like SizedChanged event handler doesn't get removed from the root visual when the window is closed.
I am guessing this happens in PopupWindowHost?
Sam
Thank you for contacting us.
We are aware of this issue and it is fixed for our internal build. Could you please download our latest internal build binaries and give it a try? Please, do not hesitate to contact us if you continue experience any problems with our RadControls.
George
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
I'll download and install internal build when it available
I am also facing the memory leak problems on my radwindows...
My application memory still increases and never frees.
Do you know when the latest internal build will be available ?
I use also radtreeview with telerik HierarchicaDataTemplate and the memory is never released..
Did you check you memory tests onto your controls ?
Are there good pratices that the memory is freed after closing windows ?
Raphael
The internal build is already released, so you could download it as well. The RadWindow control disposes itself when the GC collect it automatically. Please, note you don't keep any reference to that RadWindow, because this will prevent the object from disposing.
We are not aware of any memory leaks in the RadTreeView control. Can you give us more details about the scenario in which you found them. Also, is your RadTreeView placed inside the RadWindow? If it is can you check if the latest internal build will fix the issue. Also, can you reproduce the RadTreeView memory leak when the control isn't placed inside a RadWindow control? And when you say that the memory is never released, do you mean managed or unmanaged memory.
If you can give us more details about the definition of the RadTreeView control and the scenario where it is used, we will be able to further test it for memory leaks. Any additional info that you can give us will be highly appreciated. Thank you in advance for your cooperation.
Tina Stancheva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
Closing my window does not relase memory used from controls and objects instantiated by the window. I don't know how to do to detect what and why objects are not disposed...
Moreover, the fix comes with modifications on other controls that I have no time to check for the moment in all my application (example : the RadNumericUpDown.NumberFormatInfo is no more instantiated by default, it is null now) so I undo my replacement of binaries to get the original version.
I am gonna make simple projects to check my memory problems ton know if it comes from UI or ViewModel objects which are not disposed...
The RadWindow contains a Radtreeview expanded with about 30 items.
At the beginning, the application takes 30Mb RAM (MemTest1.JPG)
- Clic to the button, the window opens : 44Mb (MemTest2.JPG)
- Close the window : 44 Mb (MemTest3.JPG)
- Clic to the button, the window opens : 51Mb
- Close the window : 51Mb
- Clic to the button, the window opens : 56Mb
- ...
The problem does not come from the 5Mb into this test but in my real application, it's about 30Mb used for each childwindow opened to reach 900Mb !!
Here are codes for the sample :
MainPage.xaml
<
UserControl
x:Class
=
"MemoryTest.MainPage"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable
=
"d"
d:DesignHeight
=
"300"
d:DesignWidth
=
"400"
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
telerik:RadButton
Height
=
"20"
Width
=
"100"
Click
=
"RadButton_Click"
>Test</
telerik:RadButton
>
</
Grid
>
</
UserControl
>
MainPage.xaml.cs
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Net;
using
System.Windows;
using
System.Windows.Controls;
using
System.Windows.Documents;
using
System.Windows.Input;
using
System.Windows.Media;
using
System.Windows.Media.Animation;
using
System.Windows.Shapes;
namespace
MemoryTest
{
public
partial
class
MainPage : UserControl
{
public
MainPage()
{
InitializeComponent();
}
private
void
RadButton_Click(
object
sender, RoutedEventArgs e)
{
winTree win =
new
winTree();
win.ShowDialog();
}
}
}
winTree.xaml
<
telerik:RadWindow
x:Class
=
"MemoryTest.winTree"
xmlns:controls
=
"clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Width
=
"400"
Height
=
"300"
Header
=
"winTree"
>
<
Grid
x:Name
=
"LayoutRoot"
Margin
=
"2"
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
telerik:RadTreeView
>
<
telerik:RadTreeView.Items
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
IsExpanded
=
"True"
Header
=
"Test"
>
<
telerik:RadTreeViewItem
IsExpanded
=
"True"
Header
=
"Test"
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
</
telerik:RadTreeViewItem
>
</
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
IsExpanded
=
"True"
Header
=
"Test"
>
<
telerik:RadTreeViewItem
IsExpanded
=
"True"
Header
=
"Test"
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Test"
></
telerik:RadTreeViewItem
>
</
telerik:RadTreeViewItem
>
</
telerik:RadTreeViewItem
>
</
telerik:RadTreeView.Items
>
</
telerik:RadTreeView
>
<
Button
x:Name
=
"CancelButton"
Content
=
"Cancel"
Click
=
"CancelButton_Click"
Width
=
"75"
Height
=
"23"
HorizontalAlignment
=
"Right"
Margin
=
"0,12,0,0"
Grid.Row
=
"1"
/>
<
Button
x:Name
=
"OKButton"
Content
=
"OK"
Click
=
"OKButton_Click"
Width
=
"75"
Height
=
"23"
HorizontalAlignment
=
"Right"
Margin
=
"0,12,79,0"
Grid.Row
=
"1"
/>
</
Grid
>
</
telerik:RadWindow
>
Yes, we did a lot of changes to the RadWindow control which caused some bugs and leaks, but the memory leak you are talking about is fixed in internal build you are testing with. The way you are observing the memory is not right way to investigate memory leaks as the Garbage Collection collects the memory on demand. This means that window can be destroyed correctly, but the memory it uses may be freed later.
Please find the attached project that contains a memory leak test for the window control which it successfully passes with the LIB dlls and unfortunately fails with the Q2 2011 dlls.
Hope this helps.
Miroslav Nedyalkov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
I just modified a little your OpenWindow method to have more efficient result : I replace the simple content you put with a radtreeview :
private
void
OnOpenWindow(
object
sender, RoutedEventArgs e)
{
RadTreeView tv =
new
RadTreeView();
RadTreeViewItem tvi =
new
RadTreeViewItem { Header =
"Test"
, IsExpanded =
true
};
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tv.Items.Add(tvi);
tvi =
new
RadTreeViewItem { Header =
"Test"
, IsExpanded =
true
};
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tvi.Items.Add(
new
RadTreeViewItem { Header =
"Test"
});
tv.Items.Add(tvi);
var window =
new
RadWindow
{
Content = tv, WindowState = WindowState.Maximized
};
windowReference =
new
WeakReference(window);
window.ShowDialog();
}
And then, I test and take care of the memory used :
- Launch the project : 22Mb (Mem1.JPG)
- clic on the open window button, the window opens : 39Mb (Mem2.JPG)
- Close the window and force GC to free memory thanks to many clics on the button and after check that window is really destroyed : 38Mb (Mem3.JPG)
When i repeat the scenario, the memory increases more slowly (about 5Mb) but not frees as much as it takes ...
Maybe the problem comes from the treeview or content inside ?? Do you have an idea about that ?
Thanks for your help.
Raphael
As I previously mentioned the memory usage is not a correct way to test are the objects destroyed or not as the occupied memory depends on the CLR and the GC. There are various optimizations which may cause not freeing the memory immediately. For more information about how the GC works and how to track down memory problems you may refer to this article and this article.
All the best,Miroslav Nedyalkov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
The known memory leak related to the SizeChanged event of the RootVisual was fixed and there is no known memory leaks in the RadWindow control in the current version of RadControls for Silverlight.
Regards,Miroslav Nedyalkov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>