0

I have a Windows Universal App which uses several BitmapImages. I'm used to wrapping Bitmaps (in Winforms) in usings or using Dispose, but I've discovered that BitmapImage doesn't have a Dispose method. Is there any way to release their resources earlier than waiting for the GC to do that?

ispiro
  • 26,556
  • 38
  • 136
  • 291
  • Only was to force GC is System.GC.Collect(). If it doesn't implement IDisposable it can't be disposed of before GC without forcing GC to run – rmn36 Oct 13 '15 at 17:33
  • @rmn36 Right. But I was wondering if I'm missing something - If there _is_ some disposing mechanism built in to it. (It seems quite unlikely that the common use of Bitmaps is to Dispose of them as early as possible, and yet have BitmapImage with no way to do that.) – ispiro Oct 13 '15 at 17:35
  • Nope you aren't missing anything. – rmn36 Oct 13 '15 at 17:39

1 Answers1

0

Here's a good solution : Memory consumption of BitmapImage/Image control in Windows Phone 8 . it's like a extension 'Dispose' method for the BitmapImage

And yes, GC.Collect() is good way ..

Community
  • 1
  • 1
Nasser AlNasser
  • 1,725
  • 2
  • 11
  • 12