Hi,
I have a question regarding memory debugging with qt.
First a short description of what my program does:
From a separate thread (which is started by a user action), I query a sqlite-database, transform the resulting (up to a few million) rows into objects which I create the following way:
All these objects are appended to a QList which is then emitted via a signal.Qt Code:
QSharedPointer<MyObject> m = QSharedPointer<MyObject>(new MyObject));To copy to clipboard, switch view to plain text mode
After the thread which created the objects and the slot which connects to this signal terminated, the objects should be all deleted, as no one is referencing them anymore and they are packed into a QSharedPointer.
Now to my problem:
when I let the program run with the help of massif (valgrind), I can clearly see that all the memory is freed again. But when I look at the total memory consumption of the process (now without massif), It doesn't free the memory, but stays at the same level until I quit the application.
So I ran the application again with massif, but now with the commandline option --pages-as-heap=yes, which intersects the calls more low-level memory-allocation calls. And with this, I can really see that the memory does not get freed anymore.
See the images for a comparison between massif with and without the command line argument --pages-as-heap=yes
So my Question is:
why is the memory not really freed anymore?
Does Qt have its own memory-cache which it reuses for new allocations? If yes, can I somehow change this behaviour?
I'm using qt 4.7.3 under linux.
Bookmarks