How to free the memory after the BitmapImage is no longer needed?

后端 未结 4 782
悲哀的现实
悲哀的现实 2020-11-30 07:12

First, I load a BitmapImage on the Image control on the Window. Second, I work with the Image control and then close the

4条回答
  •  爱一瞬间的悲伤
    2020-11-30 07:23

    You can call Dispose() on the images in the window's Closed event. I think it may also be possible to optimise your memory footprint using different caching options.

    Edit:

    You can't call Dispose(), instead, you might consider BitmapCacheOption.None. The image will be read directly from disk and not cached in memory.

提交回复
热议问题