Not Freeing Memory ( Reading Images)

  • Thread starter Thread starter Dundy
  • Start date Start date
D

Dundy

Hi,

Are there any know bugs with reading images from file and not freeing the
object after?

We are reading numerouse image scans, which are in .PNG format and finding
that the garbage collector is not freeing the memory after reading the
images.

Any help would be most appreciated,

Bruce
 
I have found through experience that you should call Dispose() on an
Image after you're done with it, or the garbage collector won't reclaim
the space.
 
Dundy said:
Are there any know bugs with reading images from file and not freeing the
object after?

We are reading numerouse image scans, which are in .PNG format and finding
that the garbage collector is not freeing the memory after reading the
images.

Besides calling Dispose() when appropriate, be careful when copying
references around in your app. If you end up with a root level reference
that never goes out of scope, it will keep an object alive through GC.

-- Alan
 
Back
Top