It is currently August 10th, 2020, 3:58 pm

[Fixed] Memory Leak?

Report bugs with the Rainmeter application and suggest features.
User avatar
Yincognito
Posts: 2223
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG] Memory Leak?

Post by Yincognito »

Brian wrote: July 11th, 2020, 7:35 am Hmm. Good catch. This has been fixed for the next beta.

[Technical_Details]
Apparently, DirectX's newer "flip" swap effects do not play well with mixed presentation. They are supposed to perform better because you draw things directly on the backbuffer instead of the old bit block transfer method (bitblt in GDI). Since we still use GDI to "present" the drawn contents to the screen, the window handle gets lost when "flipping" the contents to the screen.

This detail was buried in the "remarks" section of Microsoft docs...and the wording is a little unclear (at least to me).
https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ne-dxgi-dxgi_swap_effect#remarks (2nd to last paragraph)
[/Technical_Details]

-Brian
Yeah, you probably talk about this:
After the first successful call to IDXGISwapChain1::Present1 on a flip-model swap chain, GDI no longer works with the HWND that is associated with that swap chain, even after the destruction of the swap chain. This restriction even extends to methods like ScrollWindowEx.
(source: https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ne-dxgi-dxgi_swap_effect#remarks)

That skin was sliding stuff, so maybe it had some connecttion with ScrollWindowEx (just a guess, I don't know C++ unfortunately, just a bit of C# when I really need to). DirectX version where this applies seems ok, as the "limit" is DirectX 11 on my video card, so that shouldn't have been a problem, considering it happened on better computers than mine. Didn't try with hardware acceleration enabled, although I'm not sure this would have had any effect.

At first sight this looked to me like something was not "released" properly, as the used memory kept accumulating. Anyway, I'm glad it's now fixed, and sorry for not being able to apply these new "flip features" in Rainmeter. Even though by the looks of it (and the info from Microsoft) they didn't improve stuff that much, they were still nice to have.