Display Image from Byte Array in WPF - Memory Issues

Posted by ChrisFletcher on Stack Overflow See other posts from Stack Overflow or by ChrisFletcher
Published on 2010-06-15T13:59:49Z Indexed on 2010/06/15 14:02 UTC
Read the original article Hit count: 551

Hi, I've developed an application to capture and save images to a database, but I'm having an issue with memory usage. On my domain object I have 3 properties:

Image - Byte array, contents are a jpg

RealImageThumb - The byte array converted to a BitmapImage and shrunk, displayed to the user in a gridview with other thumbnails

RealImage - Has no setter, the byte array converted to a bitmap source, this is shown in a tooltip when the user hovers over it.

The issue I have is that if a user hovers over each image in turn the memory usage spirals. I realise that as a user hovers over bitmap sources are generated and the memory isn't freed up, I've tried giving RealImage a backing property and assigning this to null after but again the memory isn't freed up (waiting for the garbage colelctor?.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about image