I have a ListBox with a bunch of images in it (made using datatemplate). Images are created by setting the source of the elements:
<Image x:Name="ItemImage" Source="{Binding ImageUrl}"/>
and then they are cleared using the Items.Clear () method. New images are added using the Items.Add method in the list.
However, memory usage just starts to move up and up. These are the same 300 or so small images that are displayed, but the memory does not seem to be freed. The application begins to use about 40 megabytes and quickly rises to 700 megabytes. How to free the memory that all these images use?
EDIT . One thing I forgot to mention is that images (about 4-5 thousand in size) are downloaded over the network. Is caching somehow responsible for this? A display of 12 images plays out about 10 megabytes of memory, which is about 100X files.
source
share