shotcut
shotcut copied to clipboard
closing a project does not release all memory
After analysis, I found that the shotcut will not release the memory when it closes the project, and I think this is the reason for MLT. Is there any way to solve it?I tried to modify the structure of the code, but I found that many variables were static local variables that could not be released.I'm troubled.
It does release memory, but not 100%. Here is what I found on 64-bit Windows 10 loading a small single track timeline project and measured simply using Task Manager. Loading the project and playing it through consumes 217.6 MB. Subsequent reloading and playing it consumed an additional 28 - 40 MB each time. On average, roughly 15% of memory was leaked upon reloading and playing the project.
I admit this is a bug, but I am not going to work on it right at this moment, and I do not have much advice to offer at this time. I think the "many variables were static local variables" are singletons, which are not reconstructed by design and unrelated to the problem. More than likely, some references to MLT objects are not being released. When I say "reference" I mean that logically, not literally a C++ reference. MLT is a reference-counted C framework. Its C++ wrapper uses constructors and destructors to increment and decrement the reference count. It may be that Shotcut is not deleting some pointers to MLT objects. It may be that some MLT objects are not releasing references to other MLT objects.
See also in MLT https://github.com/mltframework/mlt/issues/271