Note that this is done in WPF/C# and not in .net2.0 Winforms
I have a ListBox that contains say Class X objects. Class X contains a BitmapSource object that is displayed in the list, so it is displayed similarly to [Image] [Text]
This is loaded using CreateBitmapSourceFromHBitmap - note also that I call DeleteHBitmap to remove the HBitmap descriptor during this call, which is well known from the messages I saw on Google / etc.
I have a tree containing the specified ListBox in each TreeViewItem - usually the tree has several loaded items. Users can drag and drop these images into different TreeViewItems. To manage these operations, I manually call the operations:
<code> ItemCollection.RemoveAt </code> <code> ItemCollection.Insert </code>
to move images from the collection of ListBox elements, note that when I insert, I create a new Class X object to be inserted into the collection of ListBox elements
I noticed that I get a constant memory leak when calling such operations several times, for 5-10 minutes of constant drag and drop.
My question is:
Am I managing the BitmapSource traffic BitmapSource ? Is there something I'm doing to not completely remove the images from the ItemCollection ?
Or is there something fundamental that I missed?
c # wpf
Dave
source share