Results 1 to 6 of 6

Thread: Invalid Address specified to RtlFreeHeap

  1. #1
    Join Date
    Jan 2008
    Location
    Vancouver, Canada
    Posts
    54
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Invalid Address specified to RtlFreeHeap

    Hello,

    I am getting the following run-time error when I try to create a QDomDocument:

    HEAP[RoboExtract.exe]: Invalid Address specified to RtlFreeHeap( 00BD0000, 00CA7EC8 )
    Windows has triggered a breakpoint in RoboExtract.exe.

    This may be due to a corruption of the heap, which indicates a bug in RoboExtract.exe or any of the DLLs it has loaded.

    This may also be due to the user pressing F12 while RoboExtract.exe has focus.

    The output window may have more diagnostic information.
    The program '[5528] RoboExtract.exe: Native' has exited with code 0 (0x0).
    I originally copied the code from another project of mine, which has no trouble compiling.

    I tried different parts of the code, and I believe that it starts to occur when I create a QDomDocument:

    Qt Code:
    1. void RoboExtract::openDocument(QString dir, QString docName) //opens and returns document
    2. {
    3. QDir::setCurrent(dir);
    4. qDebug()<< QDir::currentPath();
    5. QDomDocument doc("mydocument"); //<----If I comment all other lines but this one, I still get the error
    6. QFile file;
    7. file.setFileName(docName);
    8. qDebug()<<"file name:"<<file.fileName();
    9. qDebug()<<"directory:" << dir;
    10. if (!file.open(QIODevice::ReadOnly)){ return doc;}
    11. if (!doc.setContent(&file)) { file.close();
    12. return doc;
    13. }
    14. file.close();
    15.  
    16. return;
    17. }
    To copy to clipboard, switch view to plain text mode 

    The runtime error doesn't happen until we return to the function that originally called it:

    Qt Code:
    1. void RoboExtract::readFiles(QDir directory, QString parameter)
    2. {
    3. ...
    4. openDocument(dir, docName); //function that was called (above)
    5. return; //<--when I step through, this is where the error pops up
    6. }
    To copy to clipboard, switch view to plain text mode 

    The includes are:

    #include "RoboExtract.h"
    #include <QApplication>
    #include <QTextStream>
    #include <QDir>
    #include "qdom.h"
    #include <QtDebug>
    And if I click continue when this error pops up, it continues running without anymore trouble...

    Has anyone else experienced this? Thanks!

    edit: I am using Windows XP, Visual C++ 2008 express and Qt 4.4.1

  2. #2
    Join Date
    Jan 2008
    Location
    Vancouver, Canada
    Posts
    54
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Invalid Address specified to RtlFreeHeap

    It never fails, I try to find a solution for a day and a half. I post my problem, then a few minutes later I solved it. For some reason QDomDocument doesn't like to be created implicitly (right term?).

    I changed:

    Qt Code:
    1. QDomDocument doc("mydocument");
    To copy to clipboard, switch view to plain text mode 
    to

    Qt Code:
    To copy to clipboard, switch view to plain text mode 

    But, now I am wondering if anyone knows why it won't let me declare doc that way. I have my code working....but why? Thanks!

  3. #3
    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: Invalid Address specified to RtlFreeHeap

    Quote Originally Posted by abrou View Post
    But, now I am wondering if anyone knows why it won't let me declare doc that way. I have my code working....but why?
    It might be a bug in Qt.

  4. #4
    Join Date
    Sep 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Invalid Address specified to RtlFreeHeap

    I had a similar problem with RtlFreeHeap (completely different code/project, Qt 4.4.0). After much very frustrating debugging in attached Release mode, finally traced it to creating QDomDocument with a QString parameter.

    Platform: Win XP SP3, Qt opensource 4.4.1, release multithreaded

    I should try it with 4.4.1, maybe it was fixed.

  5. #5
    Join Date
    Jun 2011
    Posts
    1
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question Re: Invalid Address specified to RtlFreeHeap

    I know it is quite an old thread, but I'm having similar issue and I'm new to Qt.

    I'm trying to clean up legacy code (a QGis plugin) that uses Qwt as it never deallocates malloc'ed memory as well as doesn't delete after new. I know there is a separate thread for Qwt, but I thought it is a general error and is related to memory management.

    AFAIK Qt uses some kind of memory management to clean up children objects through ownership.

    I tried to pin point the problem and in the essence it is the following. I don't understand why this
    Qt Code:
    1. {
    2. }
    To copy to clipboard, switch view to plain text mode 
    works while
    Qt Code:
    1. delete tmp;
    To copy to clipboard, switch view to plain text mode 
    does not and generates that exception upon delete. How can I clean up stuff from the heap as I don't provide any parent data?

    Another weird thing is that if I change it to
    Qt Code:
    1. QDialog *d = new QDialog;
    2. delete d;
    3. delete tmp;
    To copy to clipboard, switch view to plain text mode 
    . Then I get no exception at all. I'm totally lost.

    I'm using OSGeo for Windows distribution that includes Qt 4.7.1 and Qwt 5.2.1.

  6. #6
    Join Date
    Jan 2018
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Invalid Address specified to RtlFreeHeap

    In my case it was next:

    1. By mistake in my sources was used two classes with the same name
    2. One class was hidden into CPP , other had normal view header and CPP implementation.
    3. It was compilled without error but in some case segmentation fault signal was appeared)

Similar Threads

  1. Error: BadMatch --> what's it?
    By mattia in forum Newbie
    Replies: 4
    Last Post: 9th June 2008, 12:20
  2. problem with forward declaration
    By MarkoSan in forum General Programming
    Replies: 14
    Last Post: 6th January 2008, 21:45
  3. Client/Server Error: BadIDChoice
    By 3nc31 in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2007, 10:22
  4. Qtopia cross-compile for arm
    By Bitz in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 12th June 2006, 12:11
  5. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

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.