I using the profiler to trace a memory leak we are having with our application, i'm reasonable sure I have tracked down the problem but I would like confirmation that I have interprated the results corectly.
This is what i'm getting in the Type instance details
You are correct that the DataGridView is being kept in memory by the UserPreferencesChanged event, but I don't see that it should occur when changing properties on the datagrid. The allocation call stack indicates that the event handler is added in the constructor of the DataGridView, not when changing properties.
The root path tells me that the datagrid is implemented by Myriad.Controls.DataGridView. How is this class related to the System.Windows.Forms.DataGridView? Is it derived from the WinForms class? As far as I could see, the System.Windows.Forms.DataGridView does not add any event handlers to UserPreferencesChanged in the constructor, so I assume that the DataGridView in the allocation stack is the Myriad.Controls.DataGridView. Is that correct?
Without knowing more about the implementation of Myriad.Controls.DataGridView it's hard to tell why your fix doesn't work. Are you sure the event handler is hooked to the "OnUserPreferencesChanged" method?