Results 1 to 4 of 4

Thread: How to debug Heap errors

  1. #1
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default How to debug Heap errors

    Hi, wenn deleting an object (derived of a QGraphicsObject) I receive an error message:
    Heap block at 0D6EC658 modified at 0D6EC700 past requested size of a0
    The stacktrace shows nothing helpful (at least yet for me):
    0 ntdll!TpWaitForAlpcCompletion C:\Windows\system32\ntdll.dll 0 0x77bf04e5
    1 ?? 0 0x0028be90
    2 ntdll!RtlLargeIntegerDivide C:\Windows\system32\ntdll.dll 0 0x77bd5732
    3 ?? 0 0x0d5b82a0
    4 ntdll!RtlCopyExtendedContext C:\Windows\system32\ntdll.dll 0 0x77bb29fa
    5 ?? 0 0x00000000
    (full Stacktrace attached)
    The problem occurs when I allocate memory for a class member (QGraphicsRectItem*): whenever I initialize it with "new" the object will throw the above error on deletion.

    This seems "funny" because I do that all the time in the base class of the same object (which base class is in turn the afore-mentioned QGraphicsObject): QGraphicsObject-->ButtonObject-->AppButton

    As said: The ButtonObject has loads of QGraphicItems* of any kind and allocates them quite happily.

    How can I trace the problem? It's about the first time I encounter this kind of error, therefore please don't assume common knowledge.
    Attached Files Attached Files

  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: How to debug Heap errors

    Backtrace won't help here. We'd need to see the actual code or you'd need to use a dedicated tool for tracing memory leaks.
    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.


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

    sedi (17th June 2012)

  4. #3
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: How to debug Heap errors

    Thank you, Wysota! What tracing tool would you recommend?
    As the code is some 10.000 lines, spread over some 100 files it might be... ehm... quite impossible to "just post" it... :-)
    Very fortunately this error magically went away by cleanup/qmake/rebuild all - I have no idea why such a thing is possible...

  5. #4
    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: How to debug Heap errors

    Quote Originally Posted by sedi View Post
    Thank you, Wysota! What tracing tool would you recommend?
    If you were on Linux, I'd recommend valgrind, the best tool around. However it is not available for Windows so you need to look for Windows alternatives.

    As the code is some 10.000 lines, spread over some 100 files it might be... ehm... quite impossible to "just post" it... :-)
    No, but you can post the part you think is relevant to the problem.
    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.


  6. The following user says thank you to wysota for this useful post:

    sedi (18th June 2012)

Similar Threads

  1. Replies: 3
    Last Post: 27th October 2010, 10:09
  2. Qt application crashing - Heap errors?
    By System123 in forum Qt Programming
    Replies: 3
    Last Post: 23rd August 2010, 21:14
  3. compiling errors when using opengl and debug
    By invictus in forum Newbie
    Replies: 3
    Last Post: 31st March 2008, 06:16
  4. Heap Error
    By avis_phoenix in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2006, 03:15
  5. QThread and heap
    By paranoid_android in forum Qt Programming
    Replies: 2
    Last Post: 9th March 2006, 10:13

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.