buchizo / ClaudiaIDE

This extension can change easily the background image of editor window in Visual Studio.
https://marketplace.visualstudio.com/items?itemName=kbuchi.ClaudiaIDE
638 stars 112 forks source link

Memory leak with gif background #152

Closed marcel-ihle closed 1 year ago

marcel-ihle commented 1 year ago

I was pleasantly surprised after coming back from the weekend to see that the background suddenly moved. I went on to code for about 1 hour and Visual Studio was at 90% RAM usage, which is quite extreme, considering I have 64 GB RAM.

buchizo commented 1 year ago

@marcel-ihle Could you provide details to me? e.g. gif file size, settings (single image or slideshow, e.t.c) and your usage (one window or many editor window open and close)

marcel-ihle commented 1 year ago

1 window only, setting is on single image, file is attached (5.46 MB), 7270387

I'm not too sure if the whole GIF is even played, it seemed to jump back to the first frame after some seconds, even though the original file is almost seamless. The memory usage seems to slowly go up over time, I couldn't really directly observe it within a few minutes when trying to recreate it, so I went back to coding and after about 1 hour, VS became very slow to respond, so I checked and again, 90% memory usage.

buchizo commented 1 year ago

I guess MediaElement control extract all frame to memory from animation gif. That your gif image may be consumed 3GB+ memory per one time. If I use other control such as https://github.com/XamlAnimatedGif/XamlAnimatedGif , can avoid usage large memory, however application always read frame from gif file, and it is low framerate. In many case, this behavior is no problem. MediaElement is uses low memory for video and short/small animation gif files. maybe.

Normaly, static image can use one object such as singleton. But MediaElement can not singleton for multi window(background), in my case. And, I can not solve that behaviors, now.

Workaround

marcel-ihle commented 1 year ago

I do use Expand to IDE, so that doesn't really solve it, but it's fine, if it doesn't really work, there isn't too much we can do. From your message, it seems MP4 works well though? I will try that, thank you for looking into this problem. 🙂

Edit: MP4 works great. 🙂