Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plug the WPF leak... maybe. #5211

Merged
merged 1 commit into from Oct 13, 2019
Merged

Conversation

bclothier
Copy link
Contributor

Closes #4660

Using the advice from this SO thread, this seems to work. However, the memory profiling seems to have paradoxically resulted in a slight memory increase, but that might be due to extraneous factors.

Suggestions welcome to positively prove this helped the matter.

((Bitmap) source).Save(ms, System.Drawing.Imaging.ImageFormat.Png);
var image = new BitmapImage();
image.BeginInit();
image.CacheOption = BitmapCacheOption.OnLoad;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably explains the increased memory consumption; the bitmaps weight more than the leaked object pointers ;-)

OTOH this eager caching is exactly what permits cleanly disposing the stream.

@retailcoder retailcoder merged commit 06b1501 into rubberduck-vba:next Oct 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean up WPF leaks
2 participants