Known issus: WPF Image memory leak when remove image from visual tree #2397
The image source will memory leak when we remove the image from visual tree before we set the image source as null
And you can find the image source object never free
The Image memory leak
The image source object can be free
Why the image will memory leak?
Because the Image use RenderData class to storage the image source object and the
The image will never re-render when we remove the image from the visual tree and the RenderData will never update.
Why we set the image source as null and then update layout can solve?
Because the image source is null and the update layout will call render to update the