Does anyone know how to resolve to the memory leak in SL3 with the ChildWindow?
Refer to the code snippet below:
private void Button_Click(object sender, RoutedEventArgs e)
{
var window = new ChildWindow();
window.Closed += new EventHandler(window_Closed);
window.Show();
}
void window_Closed(object sender, EventArgs e)
{
((ChildWindow)sender).Closed -= new EventHandler(window_Closed);
WeakReference reference = new WeakReference(sender);
GC.Collect();
GC.WaitForPendingFinalizers();
bool isControlAlive = a.IsAlive;
}
It is always showing as still "alive" - and when I monitor the iexplore instance in Task Manager - the memory continues to increase everytime I open and close the Child Window.
Please help.
Thanks.
Chris