On Mon, Jun 4, 2012 at 10:37 AM, Lars Klassen <[email protected]> wrote: > Hi, I finally found the way to write to the mailing list, dumb me, and sorry > Dan for those private emails. > > I'm using Mlt++ on a playout server I wrote and it works like charm. But I'm > under the impression that it's leaking memory somewhere. To make things > simple, I wrote a little test app that creates a new Producer every x > seconds. The leak here is kinda "minor", after creating 1000 producers (and > destroying them) I build something like 300 MB in Physical Memory. Here is > the code to the test app: > > #include "mainwindow.h" > #include "ui_mainwindow.h" > #include <QTimer> > #include <QDebug> > MainWindow::MainWindow(QWidget *parent) : > QMainWindow(parent), > ui(new Ui::MainWindow), > _i(0) > { > ui->setupUi(this); > Mlt::Factory::init(); > _profile = new Mlt::Profile("dv_pal"); > newProducer(); > } > MainWindow::~MainWindow() > { > delete ui; > } > void MainWindow::newProducer() > { > Mlt::Producer *producer = new Mlt::Producer(*_profile, > "/Users/larcho/Movies/01.avi", 0); > producer->seek(40); > delete producer; > _i++; > QTimer::singleShot(10, this, SLOT(newProducer())); > qDebug() << _i; > } > > This by the way was tested on QT 4.8.1 running on a Mac. But I noticed > similar behavior on Ubuntu. > > Am I not destroying the Producer object properly? > > Thank you. > > PS: When I create the producer with no id (new Producer() ) the leak is not > present.
MLT uses internal memory pools for some things. It is not clear whether whether mem is leaking or the pool has simply grown and some mem chunks are available for reuse. In particular, avformat producer has image caching and the image and audio data chunks of mlt_frame are all using memory pools. Outside of this little program, in your app, if you are using a playlist, then you may need to ensure that old playlist items are removed. Or, if you want to have a large playlist and only do sequential playout, then set autoclose=1 on the playlist object. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Mlt-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mlt-devel
