Results 1 to 2 of 2

Thread: heap corrupted

  1. #1
    Join Date
    May 2009
    Posts
    38
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default heap corrupted

    I have timer to emit signal to trigger sendMessage every 30 millisecond. after hours , i got heap corruptions

    it said
    Windows has triggered a breakpoint in matx_migrate.exe.

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

    The output window may have more diagnostic information

    Qt Code:
    1. void ClientThread::sendMessage(){
    2. #ifdef _DEBUG
    3. qWarning("sendMessage %d\n", QThread::currentThreadId());
    4. #endif
    5. numOfMsg++;
    6. if(numOfMsg>CHECK_PERIOD){
    7. sendCheckMessage();
    8. numOfMsg=0;
    9. }
    10. QList<QByteArray> dataToSend= cannonPtr->getDataToSend();
    11. if(!dataToSend.isEmpty()){
    12. QByteArray data;
    13. QDataStream out( &data, QIODevice::ReadWrite );
    14. out.setVersion(QDataStream::Qt_4_4);
    15. out << (quint16)0;//reserve for size
    16. out << (quint16)dataToSend.count();
    17. for(int i=0; i<dataToSend.count(); i++){
    18.  
    19. data.append(dataToSend[i]);
    20. //out<<dataToSend[i];
    21.  
    22. }
    23. out.device()->seek(0);
    24. out<< (quint16)(data.size() - sizeof(quint16));
    25. #ifdef _DEBUG
    26. quint16 size;
    27. quint16 num;
    28. quint16 kind;
    29. qint32 frame;
    30. qint32 id;
    31. qint32 x;
    32. qint32 y;
    33. bool dead;
    34. QTime time;
    35. out.device()->seek(0);
    36. out>>size>>num>>kind>>frame>>id>>x>>y>>dead>>time;
    37. qWarning()<<"size: "<<size<<"num: "<<num<<"frame: "<<frame;
    38. #endif
    39. socketPrt->write(data);
    40. socketPrt->waitForBytesWritten();
    41.  
    42. dataToSend.clear();
    43. }
    44. }
    To copy to clipboard, switch view to plain text mode 


    any comments thanks very much

  2. #2
    Join Date
    May 2009
    Posts
    38
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: heap corrupted

    When error message pop up, thread is up to

    out>>size>>num>>kind>>frame>>id>>x>>y>>dead>>time;

Similar Threads

  1. Crash: Heap corruption due to selectedRows()
    By Ankitha Varsha in forum Qt Programming
    Replies: 16
    Last Post: 1st October 2010, 01:55
  2. QDomElement::text() returns corrupted strings
    By sladecek in forum Qt Programming
    Replies: 6
    Last Post: 7th March 2009, 15:07
  3. Java heap space
    By mickey in forum General Programming
    Replies: 1
    Last Post: 15th December 2008, 21:34
  4. Replies: 26
    Last Post: 21st July 2007, 22:34
  5. Heap Error
    By avis_phoenix in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2006, 04:15

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.