Results 1 to 3 of 3

Thread: qt memory management debugging with massif

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question qt memory management debugging with massif

    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:
    Qt Code:
    1. QSharedPointer<MyObject> m = QSharedPointer<MyObject>(new MyObject));
    To copy to clipboard, switch view to plain text mode 
    All these objects are appended to a QList which is then emitted via a signal.
    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.
    Attached Images Attached Images

Similar Threads

  1. Memory management in Qt?
    By wookoon in forum Qt Programming
    Replies: 7
    Last Post: 6th November 2010, 18:20
  2. Memory Management Reg
    By BalaQT in forum Newbie
    Replies: 10
    Last Post: 4th February 2010, 12:43
  3. Memory management
    By cyberboy in forum Qt Programming
    Replies: 2
    Last Post: 12th June 2008, 20:48
  4. Memory management questions (im new to Qt)
    By scarvenger in forum Qt Programming
    Replies: 2
    Last Post: 6th May 2007, 07:41
  5. Memory management in QT
    By Gayathri in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2006, 07:21

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.