Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
165
UltraComboEditor binding to cached lists prevents GC
posted

After several days chasing memory problems in my WinForms app, I've tracked the problem down to the following scenario:

The app is binding custom BindingList<T> business object lists (part of .NetTiers framework) to UltraComboEditors, and is caching some of those lists as they are static data. Now any form with one of the bound comboeditors on it is not being garbage collected, and several memory profilers I've used point to the comboeditors not being GCed because of a ListChangedEventHandler wired to the BindableValueList of the editor.
This means that as long as the cached list remains live, all the forms that reference it stay in memory, and as soon as I kill off the list all of those forms are GCed.

The logical solution to me is to unhook the event handler, but I haven't had any luck finding a way to do that, and going through and force-disposing every part of the comboeditor I can find doesn't do anything to unhook the handler either.

Anyone seen this pattern and know a way to work around it?
There is some talk on the net of removing event handlers using reflection and Delegate.CreateDelegate(), but haven't been able to make that work on the comboeditor yet, possibly because I don't know what the private delegate on the BindableValueList is called.

Using 2008 Vol 3 by the way.

Parents Reply Children
No Data