Results 1 to 6 of 6

Thread: Qt notify badalloc

  1. #1
    Join Date
    Aug 2012
    Location
    USSR
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qt notify badalloc

    I have a multithreaded application. I don't use iterational dynamic memory allocation (new/delete). Already I overloaded global new/delete and knew, that there are no memory leaks in cause of them. This app is eating memeory well and when it crashes (I reimplemented QApplication and notify() into it to catch exceptions) I got badalloc from QAbstractSocket. How to understand and correct memory leak. (Is there a notify overflow and why memory not released?) Where is the reason of this hell? Thank you for any help. I don't know what to do.

    Here is last data from debugger:

    Qt Code:
    1. Local variables
    2. e std::bad_alloc &
    3. [std::exception] std::exception
    4. [vptr] 0x1885b48
    5. [0] 0x17b3770 <std::bad_alloc::~bad_alloc()>
    6. [1] 0x17b3748 <std::bad_alloc::~bad_alloc()>
    7. [2] 0x17b3688 <std::bad_alloc::what() const>
    8. event @0x1928dea8 QEvent
    9. [vptr] 0x18854c8
    10. [0] 0x16e90e8 <QEvent::~QEvent()>
    11. [1] 0x16e9138 <QEvent::~QEvent()>
    12. d 0x0 QEventPrivate *
    13. m_accept 1 ushort
    14. posted 0 ushort
    15. reserved 0 ushort
    16. spont 0 ushort
    17. t 50 ushort
    18. receiver QReadNotifier
    19. snenabled true bool
    20. sntype QSocketNotifier::Read (0) QSocketNotifier::Type
    21. sockfd 1404 int
    22. engine @0x193a21d0 QNativeSocketEngine
    23. [QAbstractSocketEngine] QAbstractSocketEngine
    24. [vptr] 0x680fbc88
    25. d_ptr @0x193a21d4 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>>
    26. [QAbstractSocketEnginePrivate] QAbstractSocketEnginePrivate
    27. [QObjectPrivate] QObjectPrivate
    28. [QObjectData] QObjectData
    29. connectedSignals @0x1bfc6344 quint32 [2]
    30. [0] 0 quint32
    31. [1] 0 quint32
    32. connectionLists 0x0 QObjectConnectionListVector *
    33. currentChildBeingDeleted 0x0 QObject *
    34. currentSender 0x0 QObjectPrivate::Sender *
    35. declarativeData 0x0 QAbstractDeclarativeData *
    36. eventFilters <0 элементов> QList<QPointer<QObject>>
    37. extraData @0x1c60f8a0 QObjectPrivate::ExtraData
    38. propertyNames <0 элементов> QList<QByteArray>
    39. propertyValues <0 элементов> QList<QVariant>
    40. userData <0 элементов> QVector<QObjectUserData*>
    41. objectName "" QString
    42. pendingChildInsertedEvents <0 элементов> QVector<QWeakPointer<QObject>>
    43. senders 0x0 QObjectPrivate::Connection *
    44. sharedRefcount QAtomicPointer<QtSharedPointer::ExternalRefCountData>
    45. threadData @0x1858f3f8 QThreadData
    46. hasSetSocketError false bool
    47. localAddress 127.0.0.1 QHostAddress
    48. localPort 28911 quint16
    49. peerAddress 127.0.0.1 QHostAddress
    50. peerPort 56626 quint16
    51. receiver QTcpSocketPrivate
    52. socketError QAbstractSocket::UnknownSocketError (-1) QAbstractSocket::SocketError
    53. socketErrorString "Unknown error" QString
    54. socketProtocol QAbstractSocket::IPv4Protocol (0) QAbstractSocket::NetworkLayerProtocol
    55. socketState QAbstractSocket::ConnectedState (3) QAbstractSocket::SocketState
    56. socketType QAbstractSocket::TcpSocket (0) QAbstractSocket::SocketType
    57. exceptNotifier 0x0 QSocketNotifier *
    58. readNotifier QReadNotifier
    59. socketDescriptor 1404 int
    60. winSock QWindowsSockInit
    61. writeNotifier QWriteNotifier
    62. engine @0x193a21d0 QNativeSocketEngine
    63. str "Error std::bad_alloc sending event 6QEvent to object (13QReadNotifier)
    64. this "QDevicesRunTester" @0x22fe0c QDevicesRunTestApplication
    To copy to clipboard, switch view to plain text mode 

  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: Qt notify badalloc

    What memory leak do you mean? What does bad alloc have to do with 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. #3
    Join Date
    Aug 2012
    Location
    USSR
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt notify badalloc

    I mean that memory usage of appliacation in Windows task manager only increasing. It starts from 53 mb and when it become about 1 GB I get this crash.

  4. #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: Qt notify badalloc

    So fix your code, I still fail to see any relation with exceptions. The problem is not when allocation fails but much earlier when you don't free memory you don't use.
    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.


  5. #5
    Join Date
    Aug 2012
    Location
    USSR
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt notify badalloc

    What kind of problem I need to looking for? New/delete - ok. I don't overload events. For intercation between threads I use only signals and slots.

  6. #6
    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: Qt notify badalloc

    There is no point in guessing. Either use a memory profiler or analyze your code for allocated data you do not need. Be sure to use proper tools, Windows task manager is not a reliable tool for tracking memory consumption.
    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. Replies: 7
    Last Post: 27th March 2014, 12:14
  2. QApplication::notify reimplementation
    By sa5webber in forum Newbie
    Replies: 0
    Last Post: 31st August 2012, 00:00
  3. linux usb notify
    By duckshine in forum General Programming
    Replies: 1
    Last Post: 27th May 2011, 11:16
  4. QApplication::notify()
    By jeffpogo in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2009, 23:46
  5. Qt web notify
    By bunjee in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 14:24

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.