From the help my guess is that it creates a copy to cache it, and maybe one copy scaled down to use it on the button. And while the GC doesn't collect all the data that copied into the streams there will be multiple copies in the memory.
Ben: With some research, I found what you have mentioned above but trying to figure out how to resolve. – user296623 May 26 at 19:49 Can you explain your useage pattern? Where you use the images, how much images, what size they have?
If you use a lots of images that always needs to be seen or referenced, than I think you can't avoid a big memory useage especially if you use big images. – Ben May 26 at 20:27 Each image size is around 45KB. I have 30 custom buttons with each showing 4 images.So, its 120 images in total which can occupy upto 6 - 7 MB memory (120 x 44K).
But my application is using about 1.2GB and I get Out of memory exception. – user296623 May 26 at 20:56 There must be some bug somewhere, I recenlty wrote an editor to our artists that uses and displays more images(100-200 images with size is around 100-300KB) and its not using more than 250MB of memory. But my images loaded from disk.
Maybe there are some reference to your byte array that prevents the GC to collect it? How big that memory spike when you creates a BitmapImage? – Ben May 26 at 21:08 Its around 5000KB for each image.
– user296623 May 26 at 21:12.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.