Geeks With Blogs
Adrian Hara Working through the .NET maze November 2009 Entries
Nasty DispatcherTimer memory leak
Profiling some memory problems in the latest project i worked on we found out something rather disturbing: IF a WPF UserControl/Window uses a DispatcherTimer (declared as a private member in the UserControl's code-behind) AND the event handler for the timer's Tick event is also declared in the UserControl's code-behind AND that UserControl/Window is shown/opened by a parent WHEN the UserControl/Window is dismissed WITHOUT stopping the Timer or unsubscribing from its Tick event THEN you have a memory ......

Posted On Thursday, November 5, 2009 4:31 AM

Copyright © Adrian Hara | Powered by: