On 10/30/2015 10:08 AM, Etienne Sandré-Chardonnal wrote:
Dear all,

I have an app which runs several days executing computation jobs (about one job
every few minutes). In some cases, the memory consumption grows to several Gb
unexpectedly.


If someone is still pointing at a piece of memory then it
is not a leak as defined by programs like Purify and Valgrind.

The most important thing to do is to understand how the program works.
When does it allocate memory, when does it free it and then verify that
the memory has in fact been freed.

For your objects, put print statements in constructors and destructors.
Match them up and look for missing destructor calls.
At least them you will know which objects are not being freed.

Also, use techniques like QScopedPointer to simplify memory
management.

I have run valgrind with no success. There was a few minor leaks which were
fixed, but now the valgrind result is 100% clean and the issue is still there.

However, I'm wondering if this is not due to QObjects which have a parent but
which have been forgotten. It could be anything from QThreads to QTcpSockets. As
they have a parent, they are not leaked in the classical sense, and will be
freed when the app quits, but still they make the program infinitely eating 
memory.
Some objects also have no parent (such as the root objects running a QThread
event loop) but have signal/slot connections and thus are still referenced
somewhere in a table, thus defeating valgrind.

Is there any tool for detecting this? Such as one tracking the QObject tree, or
the number of QObject allocated per subclass?

I'm already trying to solve this the classical way, by displaying debug messages
to ensure that objects are deleted, but so far this has been unsuccessful as the
program is quite complex.

Thanks!


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to