Results 1 to 2 of 2

Thread: 'memory leak' threads on QT centre

  1. #1
    Join Date
    Jan 2007
    Posts
    38
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default 'memory leak' threads on QT centre

    I have read all the threads, but none seem to answer, specifically, the questions i have, so i decided to ask them here:


    Am i leaking memory by writing my code as follows:



    Qt Code:
    1. class QHeaderView ;
    2.  
    3. class SomeClass : public QDialog, public Ui_SomeForm
    4. {
    5. Q_OBJECT
    6.  
    7. .......
    8.  
    9.  
    10.  
    11. private:
    12. QHeaderView *header;
    13. ....
    14. };
    To copy to clipboard, switch view to plain text mode 

    and in my constructor of SomeClass the pointers are all initialized as follows:

    Qt Code:
    1. SomeClass::SomeClass(QWidget *parent )
    2. : QDialog(parent)
    3. {
    4. setupUi(this);
    5.  
    6. ......
    7.  
    8.  
    9. model = new QSqlTableModel(this);
    10. header = new QHeaderView(Qt::Horizontal,this);
    11. mapper = new QDataWidgetMapper(this);
    12.  
    13. .....
    14. }
    To copy to clipboard, switch view to plain text mode 

    I do not call delete on any of these pointers. Am i doing something wrong here? Oh and i never get errors on memory leaks, i am just really trying to make sure i am not creating any.

    Also, where would you recommend that i call delete?

    I am using MSVS .NET 2003, with the QT-VS integration;

    if i do have memory leaks, could you direct me to some fast and accurate debug application that i can run in .NET, that will help me to identify them?

    also, if memory leaks occur while my programs run, is it a FACT that after the program closes the memory is returned to the operating system?

    thanks in advance for your attention, your time is valuable and it is appreciated.
    Last edited by locus; 29th January 2007 at 18:00. Reason: was not finished

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 'memory leak' threads on QT centre

    Every QObject that has a parent will be deleted when its parent gets destroyed.

  3. The following user says thank you to jacek for this useful post:

    locus (29th January 2007)

Similar Threads

  1. Memory leak
    By vvbkumar in forum General Programming
    Replies: 4
    Last Post: 2nd September 2006, 15:31
  2. Memory leak
    By zlatko in forum Qt Programming
    Replies: 8
    Last Post: 28th March 2006, 19:02
  3. Qt 4.1 Memory Leak
    By blackliteon in forum Qt Programming
    Replies: 14
    Last Post: 10th February 2006, 12:47

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.