Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. program crashed when call QByteArray::resize in win7
Forum Updated to NodeBB v4.3 + New Features

program crashed when call QByteArray::resize in win7

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 561 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qtyangyong
    wrote on last edited by
    #1

    win7 64bit servicepack 1 , QT5.12.12
    program crashed when long time run. debug mode get the error is an uncatched unknow exception; error caused code is QByteArray::resize, error hint on console is C0000374
    i donn't know why the resize method cause heap exception.
    does someone know this question?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Unless you're trying to resize to some ridiculous size the crash is unlikely to be caused by resize. It could be just a symptom of some previous fail.

      Heap corruption could be almost anything. You could be using a released object, have a leak and run out of virtual space, write out of bounds of some container etc. It's impossible to guess without more information.

      If the crash happens after a long run my first guess would be you have a memory leak somewhere and when you call resize it fails due to heap exhaustion or fragmentation. Check what's your memory usage when you crash.

      Other than that - if you run it under a debugger what's the full callstack? Maybe the culprit is somewhere higher. What size is the array? What size are you trying to get? Is the array object valid at the point of the call e.g. could it be a member of an object that no longer exists?

      1 Reply Last reply
      2
      • Q Offline
        Q Offline
        qtyangyong
        wrote on last edited by
        #3

        Thanks for your answer. The code and call stack are confirmed, It looks all right. Finally, I canceled all QByteArrays and used char * to handle them. The problem was solved. My conclusion is that in some cases, memory management of QByteArray will cause failure.

        Christian EhrlicherC Chris KawaC 2 Replies Last reply
        0
        • Q qtyangyong

          Thanks for your answer. The code and call stack are confirmed, It looks all right. Finally, I canceled all QByteArrays and used char * to handle them. The problem was solved. My conclusion is that in some cases, memory management of QByteArray will cause failure.

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @qtyangyong said in program crashed when call QByteArray::resize in win7:

          is that in some cases, memory management of QByteArray will cause failure.

          For sure not.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • Q qtyangyong

            Thanks for your answer. The code and call stack are confirmed, It looks all right. Finally, I canceled all QByteArrays and used char * to handle them. The problem was solved. My conclusion is that in some cases, memory management of QByteArray will cause failure.

            Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @qtyangyong said:

            My conclusion is that in some cases, memory management of QByteArray will cause failure.

            That's a really bad conclusion. You just have a bug somewhere.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved