QMovie leaking lots of pixmap resources

Martijn Klingens klingens at kde.org
Thu Jan 1 14:25:16 GMT 2004


In Kopete we have a bug where just opening a chat window and leaving it open 
starts leaking memory and eventually makes Kopete or the entire box crash 
(http://bugs.kde.org/show_bug.cgi?id=62669).

I tracked this down to a QMovie that starts leaking the pixmaps even when it 
is NOT being used! Just the loadMovie call in 
kdenetwork/kopete/kopete/chatwindow/kopetechatwindow.cpp around line 462 is 
enough to trigger it. To view for yourself: start Kopete, fire up xrestop or 
your own favourite debugging tool and watch Kopete leak about 30 kb/sec as 
soon as you open a chat window.

The problem is, I have *no* idea why it starts leaking. Commenting out the 
loadMovie call stops it. Replacing loadMovie() with a manual 
QMovie( "/full/path/to/movie.mng" ) does not solve the problem, nor does 
creating a standalone movie using 'new QMovie( "/some/path" )'.

However, when I try to create a small test app containing

int main( int argc, char *argv[] )
{
	QApplication app( argc, argv );

	QWidget w( 0L );
	w.show();
	app.setMainWidget( &w );

	// This works as expected
	QMovie m( "test.mng" );

	app.exec();

	return 0;
}

it doesn't show the problem. :(

Does anyone here have any idea where the leak comes from? I can 100% reproduce 
it in Kopete and not at all outside Kopete. What is strange is that even just 
'new QMovie( ... )' triggers it, and that movie for sure is never used in the 
code, it's not even assigned to a pointer.

It also seems to me that a movie that is not being shown still fires QTimers 
in Qt itself, which sounds like bad optimization.

Suggestions welcome.

-- 
Martijn




More information about the kde-core-devel mailing list