Huge amount of memory leaks
Hi Openshot Team,
I want to report about huge memory leaks in libopenshot.
Also I saw some merged PRs fixing some of them, but leaks still exists.
Here is the simple code snippet demonstrating and confirming it. I'm running this in Ubuntu 20.04.
#include <string>
#include <Clip.h>
#include <OpenShot.h>
#include <FFmpegWriter.h>
#include <Timeline.h>
void renderSimple()
{
/// Creating clip
openshot::Clip clip("videos/1.mp4");
/// Creating Timeline
openshot::Timeline timeline(1920, 1080, openshot::Fraction(30, 1), 48000, 2, openshot::ChannelLayout::LAYOUT_STEREO);
timeline.Open();
// Adding above created clip into the timeline
timeline.AddClip(&clip);
/// Create writer for output video
auto writer = new openshot::FFmpegWriter("videos/output.mp4");
// Setting audio and video options
writer->SetAudioOptions(true, "aac", 48000, 2, openshot::ChannelLayout::LAYOUT_STEREO, 128000);
writer->SetVideoOptions(true, "libx264" , openshot::Fraction(30, 1), 1920, 1080, openshot::Fraction(1,1), false, false, 1600000);
// Prepare writer
writer->Open();
// Write only 200 frames from input clip
writer->WriteFrame(&timeline, 0, 200);
// Close writer and reader objects
writer->Close();
delete writer;
timeline.Close();
clip.Close();
}
int main(int argc, char* argv[])
{
renderSimple();
/// Adding this line to keep program running in order to check
/// final memory usage of program after all resource cleanup
while(true);
return 0;
}
I placed this code in examples/Example.cpp and built from develop branch. I used arbitrary mp4 video, so you can use anything you want. I'm sure that the problem will be visible with any input video.
I tried to understand from where coming those leaks, but still there is no success. BTW: You can use valgrind to see reports about leaks. I looked on it, but I'm not familiar with openshot source base (which is large enough) to fix it quickly.
Note: I also included some fixes from this PR, which fixes some additional leaks, but not all of them.
Can you please take a look?
Thanks in advance.
thanks for recommending valgrind. I'll have to take a look into that.
Thank you so much for submitting an issue to help improve OpenShot Video Editor. We are sorry about this, but this particular issue has gone unnoticed for quite some time. To help keep the OpenShot GitHub Issue Tracker organized and focused, we must ensure that every issue is correctly labelled and triaged, to get the proper attention.
This issue will be closed, as it meets the following criteria:
- No activity in the past 90 days
- No one is assigned to this issue
We'd like to ask you to help us out and determine whether this issue should be reopened.
- If this issue is reporting a bug, please can you attempt to reproduce on the latest daily build to help us to understand whether the bug still needs our attention.
- If this issue is proposing a new feature, please can you verify whether the feature proposal is still relevant.
Thanks again for your help!
It would be great if you test again with the latest DEV Daily Build and let us know if you are still seeing these leaks. Go to openshot.org/download/#daily and download the lates DEV Daily Build AppImage.
Thank you so much for submitting an issue to help improve OpenShot Video Editor. We are sorry about this, but this particular issue has gone unnoticed for quite some time. To help keep the OpenShot GitHub Issue Tracker organized and focused, we must ensure that every issue is correctly labelled and triaged, to get the proper attention.
This issue will be closed, as it meets the following criteria:
- No activity in the past 90 days
- No one is assigned to this issue
We'd like to ask you to help us out and determine whether this issue should be reopened.
- If this issue is reporting a bug, please can you attempt to reproduce on the latest daily build to help us to understand whether the bug still needs our attention.
- If this issue is proposing a new feature, please can you verify whether the feature proposal is still relevant.
Thanks again for your help!
No feedback from user.