I have loaded a list of images out of a filestream database. When I load them initially the memory jump isn't that large. When I display them on the screen my memory usage spikes and doesn't go away even after I dispose of the BitmapImage streamsource and set it to Nothing.
Dim newItem As New MIdentifiedImage
Dim data As Byte() = dt.Rows(i).Item("ScannedImage")
Dim strm As New MemoryStream(data)
Dim bi As New BitmapImage()
bi.BeginInit()
bi.StreamSource = strm
bi.EndInit()
bi.Freeze()
newItem.ScannedImage = bi
And here is my dispose code
For Each img In InvoiceObj.ImageList
img.ScannedImage.StreamSource.Dispose()
img.ScannedImage.StreamSource = Nothing
Next
So my profiler says that the memory usage is low but when I check in my task manager the memory usage is quite high. If I continue to load images beyond 1.5GB of memory it just stops showing the images on screen.