Results 1 to 18 of 18

Thread: QT Memory Leaks

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QT Memory Leaks

    Suggestion for improvement using VLD:

    1. Make sure you include the VLD header as the absolute very first header of your complete program.
    2. Make sure that if VLD is a library, it is loaded as the very first library of your complete program.

    While I don't think Qt is free of memory leaks, I don't think it contains 2400+ leaks. That's madness.

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QT Memory Leaks

    I'm fairly sure that Qt does a lot of it's own memory management, bypassing malloc and new. This is certainly true for QStrings, which do a lot of referencing to avoid unnecessary data copies. Unfortunately, this sort of optimization hoses most leak checkers; a lot of them simply match calls to malloc/free or new/delete and note when there's an imbalance.

    Since the number of leaks appears to be constant, rather than increasing with program load, I'd guess this is the case. See if your program actually consumes an increasing amount of memory over time and with increasing program load. If not, these reports can probably be safely ignored. I don't know what sort of tools are available for this under Windows; the Task Manager is notorious for giving bogus memory usage reports.

    Note, too, that you may have to build Qt in debug mode in order to get the most useful information out of these tools; in release mode, they'll tend to be accurate, but not precise.

  3. #3
    Join Date
    Feb 2012
    Location
    INDIA
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows Symbian S60

    Default Re: QT Memory Leaks

    can any one plz tell me that how to use VLD whit Qt Creator 2.2.1
    i have download "vld-10.zip"
    in which i got following files
    1) vld.h
    2) vldapi.h
    3) dbghelp.dll
    4) vld.lib
    5) vldmtdll.lib
    6) vldmt.lib

    plz help me that i acn use it with Qt Creator 2.2.1
    Last edited by hitesh_; 28th February 2012 at 06:47.

  4. #4
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT Memory Leaks

    Quote Originally Posted by SixDegrees View Post
    I'm fairly sure that Qt does a lot of it's own memory management, bypassing malloc and new.
    you can't allocate to the heap without malloc/new.

    also, if you add -widgetcount (iirc) to command line options then Qt gives its own 'memory report' at the end.
    http://doc.trolltech.com/4.6/qapplic...l#QApplication
    Last edited by amleto; 28th February 2012 at 20:07.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. memory leaks detection in QT
    By kompotFX in forum Qt Programming
    Replies: 15
    Last Post: 28th January 2009, 21:29
  2. Memory Leaks
    By kaushal_gaurav in forum Qt Programming
    Replies: 4
    Last Post: 20th October 2008, 16:26
  3. Memory leaks..
    By santhoshv84 in forum Qt Programming
    Replies: 2
    Last Post: 28th August 2008, 19:28
  4. memory leaks
    By Fastman in forum Qt Programming
    Replies: 1
    Last Post: 5th March 2008, 08:00
  5. why there are memory leaks in Qt?
    By cocalele in forum Qt Programming
    Replies: 1
    Last Post: 19th March 2006, 09:55

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.