Results 1 to 10 of 10

Thread: Memory leaks with QDomElement::tagName()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2011
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Memory leaks with QDomElement::tagName()

    Hello,

    this is the scenario:
    - VStudio2005, using Qt4.7.2, built for VS2005 (dumpbin -imports on the Qt libs refering to VS80 libs)
    - I build another dll which links QtXml4.dll

    THIS method is creating memory leaks:

    Qt Code:
    1. int CTestClass::blubber( int iBlubber )
    2. {
    3. QDomElement aRoot;
    4. aRoot.tagName();
    5. return 0;
    6. }
    To copy to clipboard, switch view to plain text mode 

    and THE SAME method with commented tagName() is NOT creating memory leaks:
    Qt Code:
    1. int ARGOSXml_DomParser::blubber( int iBlubber )
    2. {
    3. QDomElement aRoot;
    4. // aRoot.tagName();
    5. return 0;
    6. }
    To copy to clipboard, switch view to plain text mode 

    NOTE: I do NOT call this method! just linking!

    I am really helpless... perhaps anyone got an idea!

    If you need more information, please ask!

    Any help is appreciated!
    saracaeus

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Memory leaks with QDomElement::tagName()

    How do you measure that it is a memory leak? I can't see it.

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

    Default Re: Memory leaks with QDomElement::tagName()

    This is how this method is implemented:

    Qt Code:
    1. QString QDomElement::tagName() const
    2. {
    3. if (!impl)
    4. return QString();
    5. return impl->nodeName();
    6. }
    To copy to clipboard, switch view to plain text mode 
    I don't see where it could possibly leak memory.
    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.


  4. #4
    Join Date
    Sep 2011
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Memory leaks with QDomElement::tagName()

    well, thats exactly why I am helpless... I have no clue... the memory leaks coming from VS2005, this is the output:

    Qt Code:
    1. Detected memory leaks!
    2. Dumping objects ->
    3. {220} normal block at 0x012F4550, 24 bytes long.
    4. Data: < > 00 CD CD CD 00 00 00 00 00 00 00 00 00 00 00 00
    5. {219} normal block at 0x012F44F0, 32 bytes long.
    6. Data: < > 01 00 00 00 03 00 00 00 00 00 00 00 01 00 00 00
    7. {218} normal block at 0x012F44B0, 4 bytes long.
    8. Data: < D/ > F0 44 2F 01
    9. {217} normal block at 0x012F4458, 24 bytes long.
    10. Data: < > 00 CD CD CD 00 00 00 00 00 00 00 00 00 00 00 00
    11. {216} normal block at 0x012F4410, 12 bytes long.
    12. Data: <XD/ ;g ;g> 58 44 2F 01 C8 DD 3B 67 C8 DD 3B 67
    13. {215} normal block at 0x012F43B8, 24 bytes long.
    14. Data: < > 00 CD CD CD 00 00 00 00 00 00 00 00 00 00 00 00
    15. {214} normal block at 0x012F4370, 12 bytes long.
    16. Data: < C/ ;g ;g> B8 43 2F 01 C8 DD 3B 67 C8 DD 3B 67
    17. {213} normal block at 0x012F4318, 24 bytes long.
    18. Data: < > 00 CD CD CD 00 00 00 00 00 00 00 00 00 00 00 00
    19. {212} normal block at 0x012F42B8, 36 bytes long.
    20. Data: < C/ pC/ D/ > 18 43 2F 01 70 43 2F 01 10 44 2F 01 00 00 00 00
    21. {211} normal block at 0x012F4278, 4 bytes long.
    22. Data: < B/ > B8 42 2F 01
    23. {210} normal block at 0x012F4238, 4 bytes long.
    24. Data: < Y.g> A8 59 2E 67
    25. Object dump complete.
    26. The thread 'Win32 Thread' (0x814) has exited with code 0 (0x0).
    To copy to clipboard, switch view to plain text mode 

    And as I noted: the method is NOT even called!

    And once i comment this line, the memory leaks are gone!


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

    Default Re: Memory leaks with QDomElement::tagName()

    When is that "leak" reported? If the method is not called, it can't possibly create a memory leak. If you have a leak then it is elsewhere.
    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 Memory Leaks
    By lukabratzi in forum Qt Programming
    Replies: 17
    Last Post: 28th February 2012, 20:01
  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.