I have a Windows Universal App which uses several BitmapImage
s. I'm used to wrapping Bitmap
s (in Winforms) in using
s 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?
Asked
Active
Viewed 1,124 times
0

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 Answers
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