PDA

View Full Version : Memory Leak in Qt



Krish_ng
22nd July 2007, 06:49
I hav developed an application for 32MB RAM.I need to know the places where memory leaks may occur.I hav a splitter with 5 listwidgets.I am taking data from file into QList and in turn putting into QListWidget.I hav taken 4 pages of items.I am also writing event filters for up and down keys.On a 32MB machine such a scroll takes a lot of time.Any idea were actually memory leaking occurs.

marcel
22nd July 2007, 07:20
And why are you sure there are memory leaks?
Could you post some code?

That amount of memory is considered to be small for a long period of time ( years, even ), so there is no surprise the application is moving slow.

Anyway, you need a profiler to do a memory analysis...
See: http://trolltech.com/developer/knowledgebase/faq.2007-04-25.9056652809/
Purify can be downloaded as a trial version and Valgrind is free.

Also, take a look at: http://trolltech.com/developer/knowledgebase/363/. Those tools not always give a correct report.

Regards

Krish_ng
22nd July 2007, 07:48
I hav update functions that update the 4 ListWidget.First page has 15 items and next scroll starts from 10 th element.I hav used scrollToItem to get the 10th element position.The scrolling of the items is taking more time on 32MB machine.Is there any alternative to improve performance.On the first display the 4 listwidgets are made visible.Next scroll is happening through the eventfilter.

someSplitter->updateFirstView(0, end);
There are 4 such methods for each listwidgets.

marcel
22nd July 2007, 08:02
Considering you don't have a large number of items in the list widgets, I could say the delay is abnormal.

But, I ask you again: can you post some code? Especially update*View() functions.

I cannot tell you very much with the current information.
You can try playing a little bit with QListWidget::setLayoutMode(QListWidget::Batched) and QListWidget::setBatchSize(5);

Regards