As part of a technical discussion of memory profiling, I purposely added events that were not unregistered in my company's Winforms-WPF application. There was no indication of a memory leak in the profiler. I then wrote a smaller WPF application that just pops up a window. The DataContext of the window has an event that is not getting unregistered...yet I never see instances of the popup window in the memory profiler. I am using VS2019. See attached project.
Comments
3 comments
-
Forgot to mention I am running Version 11.0.0.1816 standard
-
In MainWindow.xaml.cs, I register for an event that I never unregister from.
I would expect there to be a buildup of PopupWindow instances as I open and close the window, but I see no instances in the profiler.
private void Button_Click(object sender, RoutedEventArgs e){TestDataContext data = new TestDataContext();data.CloseEvent += Window_CloseTestEvent;PopupWindow window = new PopupWindow(data);window.ShowDialog();}private void Window_CloseTestEvent(object sender, System.EventArgs e){//if (sender is TestDataContext window)// window.CloseEvent -= Window_CloseTestEvent;} -
Hello jegray12,
Without a solution to examine I'm admittedly speculating, based on your description I anticipate the flawed logic you instituted failed to grow sufficiently to meet the required threshold for it to be identified.
https://documentation.red-gate.com/amp/understanding-memory-problems/memory-management-primer
The tooling aims to highlight what is growing excessively, as opposed to what conceptually could.
Add comment
Please sign in to leave a comment.