Results 1 to 2 of 2

Thread: QtScript:Who delete created object - QScript or memory leak will be?

  1. #1
    Join Date
    Oct 2009
    Location
    Russia, South Ural, Chelyabinsk
    Posts
    42
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QtScript:Who delete created object - QScript or memory leak will be?

    Hi to all!
    I have some problem with memory managment in qt script.
    Who delete object without parent (=0) - QtScript, or memory leak will be???

    Qt Code:
    1. //example of script
    2. function testMe()
    3. {
    4. var user = UserManager.createUser(); //UserManager is a var of UserManager class added to script.
    5. //user.Login = "Mike";
    6. }
    To copy to clipboard, switch view to plain text mode 


    //class definition
    Qt Code:
    1. class User: public QObject
    2. {
    3. .....
    4. };
    5.  
    6. class UserManager: public QObject
    7. {
    8. ...
    9.  
    10. public slots:
    11. createUser()
    12. {
    13. return new User(NULL);
    14. }
    15. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 19th February 2010 at 10:59.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtScript:Who delete created object - QScript or memory leak will be?

    I would say the default ownership when creating objects is QtOwnership or AutoOwnership which makes you responsible for deleting a parentless object.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Qt dll + memory leak
    By Fastman in forum Qt Programming
    Replies: 3
    Last Post: 2nd August 2009, 13:28
  2. Memory leak of Qt?
    By Sheng in forum Qt Programming
    Replies: 1
    Last Post: 1st April 2009, 23:32
  3. Replies: 4
    Last Post: 19th February 2009, 11:10
  4. Memory leak
    By vvbkumar in forum General Programming
    Replies: 4
    Last Post: 2nd September 2006, 15:31
  5. Memory leak
    By zlatko in forum Qt Programming
    Replies: 8
    Last Post: 28th March 2006, 19:02

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.