exeldro / obs-shaderfilter

OBS Studio filter for applying an arbitrary shader to a source.
GNU General Public License v2.0
377 stars 39 forks source link

Memory leaks #24

Open YorVeX opened 10 months ago

YorVeX commented 10 months ago

Setup: obs-shaderfilter 2.1.1 with OBS 29.1.3 on Windows 10

Repro:

How many depends on the number of shader filters configured, for my simple repro scenario with just one I can get as little as 4, in my real setup with lots of shaders configured (but not even activated) already a short start and stop of OBS currently reports 1199 memory leaks, I also saw more than 3000 in some runs.

exeldro commented 10 months ago

Thank you for the report. I just made memory leak fixes in master branch, that seems to fix all of them for my tests. Can you verify if that fixes all of them for you? You should be able to get a build from: https://github.com/exeldro/obs-shaderfilter/actions/runs/6706036917

YorVeX commented 10 months ago

In my simple repro scenario above it went down from 4 to zero.

In my real setup the number of memory leaks went down from 1199 to 118, but that OBS instance is also using the obs-stroke-glow-shadow and obs-composite-blur plugins which according to the commit message also had memory leak fixes that you helped with. After I also installed the latest master branch builds for these two the memory leaks now went down to 25.

When I disabled the two other plugins for testing the number stayed at 25, so they seem to be fine now. When I disable obs-shaderfilter it goes down to 20, so apparently a few last leaks are still coming from this plugin. Will try to narrow it further down and report back here.

YorVeX commented 10 months ago

Boy, that was tedious. I got a lot of shaders and disabled them bit by bit, then restarted OBS twice to check the logs.

Since I recently reorganized stuff some of them didn't exist anymore in the path the shader filter configuration in OBS pointed to, and apparently that's what's causing memory leaks, at least one for each shader that points to a non-existing shader file.

For the repro scenario above simply rename Add.shader to something else after it was already configured, then start OBS, exit, and you get 1 memory leak. image

The other memory leaks I still had were from the obs-shaderfilter-plus plugin, which I still use, because I still have lots of shaders that were specifically created for this plugin, and another one is coming from your 3D effect plugin (sorrrryyyyyyy 😝).

TBH about this last one from obs-shaderfilter I don't care too much, at least that memory leak is an indication that something is configured wrong and made me start looking and finding these cases. I'll leave it up to you to also fix that special case or just close this issue and ignore it. If you opt to fix it I will be happy to do another test for confirmation, I still kept my old scenes file with multiple shaders with wrong file configurations to test this with.

YorVeX commented 10 months ago

Not sure whether 2.1.2 was supposed to also fix the memory leaks when the configured shader file is missing, so just to be on the safe side: they're still there with 2.1.2.