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
1285
ComboEditor not releasing object
posted

In using .NET memory profiler, I found an issue.

I have a class that is static, which contains a datatable that gets populated from a database. Since the data never changes but the application will use the data over and over I decided to make it static and do just one database transaction to get the data.  This data is used to populate the items in your ComboEditor control. Here is the code:

xamComboEditorAgency.ItemsProvider.ItemsSource = Cache.Agencies.Data.DefaultView;
            xamComboEditorAgency.ItemsProvider.DisplayMemberPath = "Display";
            xamComboEditorAgency.ItemsProvider.ValuePath = "ID";

XAML:

 <igEditors:XamComboEditor Grid.Row="0" Name="xamComboEditorAgency"  Theme="[current]" Value="{Binding Path=AgencyID}">
                        <igEditors:XamComboEditor.ItemsProvider>
                            <igEditors:ComboBoxItemsProvider />
                        </igEditors:XamComboEditor.ItemsProvider>
                    </igEditors:XamComboEditor>

 

.NET mem profiler shows that the control creates a ListChangedEventHandler and attaches to the defaulteView ListChanged event on the dataTable.  Is there a way that I can prevent it from doing that or a way where I detach the event handler?

I believe this can cause a memory leak.

Attached is a pic of the Instance graph