I have a ListBox with a bunch of images in it (done through a datatemplate). The images are created by setting the items source:
<Image x:Name="ItemImage" Source="{Binding ImageUrl}"/>
and then they are cleared by using the listbox's Items.Clear() method. New Images are added by using the Items.Add method of the listbox.
However, memory usage just starts moving up and up and up. It is the same 300 or so small images that are getting displayed, but the memory never seems to get freed. The App starts using about 40Megs, and quickly climbs up to 700Megs. How do I free up the memory that all these images are using?
EDIT: One thing I forgot to mention, the images (which are about 4-5k each in size) are being loaded over the network. Is caching somehow responsible for this? Displaying 12 Images chews up about 10 Megs of memory, which is about 100X filesize.