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. Qt crashing for larger programs?
Forum Updated to NodeBB v4.3 + New Features

Qt crashing for larger programs?

Scheduled Pinned Locked Moved Solved General and Desktop
19 Posts 5 Posters 3.0k Views 3 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.
  • H Offline
    H Offline
    Hubbard
    wrote on last edited by Hubbard
    #9

    Okay my call stack has thousands of items in it. Guess that will happen when you use signals and slots as traces inbetween components all interrupting each other. Is there any way to 'clear' this upon each cycle or something??

    mrjjM 1 Reply Last reply
    0
    • H Hubbard

      Okay my call stack has thousands of items in it. Guess that will happen when you use signals and slots as traces inbetween components all interrupting each other. Is there any way to 'clear' this upon each cycle or something??

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #10

      @Hubbard
      Hi
      Not really if you mean sort of a filter.
      but when crashed, the top ones should be what happen just before crash.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Hubbard
        wrote on last edited by
        #11

        It says ntdll!RtAllocateHeap
        Surely the fact that there are thousands of calls is the problem?

        Sorry I'm not used to debugging programs, i'm an engineer not a developer

        mrjjM 1 Reply Last reply
        0
        • H Hubbard

          It says ntdll!RtAllocateHeap
          Surely the fact that there are thousands of calls is the problem?

          Sorry I'm not used to debugging programs, i'm an engineer not a developer

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #12

          @Hubbard
          Hmm, RtAllocateHeap does suggest its memory related.
          Did u check the apps mem consumptions.
          oh, well maybe we should talk about the tools available then.
          (might help)
          In such case here where it happens after X runs, its very useful to instruct the debugger to wait to halt at a break point until some condition or
          simple counts.
          If u place a break point in the main method and right click the break point. You can select edit and get dialog with options.
          alt text
          So it should be possible to setup so it runs till almost crash "turn" and you can single step to find the line where it something happens.

          I dont think its possible for us to guess here what is wrong. You will have to find it with the debugger.

          1 Reply Last reply
          1
          • H Offline
            H Offline
            Hubbard
            wrote on last edited by
            #13

            I had a look through and the line it breaks upon is completely uneventful (literally writing a string to qDebug(), which, to my knowledge, shouldn't crash anything).

            0_1524947591765_1a51bbe5-cf7d-434e-a5e9-e300def79c01-image.png

            This is how my program works, components emit signals to each other and the target components emit more signals of processed information until its stored in that heap there in memory or a component emits a finish signal to the PC, so there is no real program flow just lots of classes interrupting each other, this is why the call stack is so huge I think. Is this a problem?

            W 1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #14

              Hi,

              Then I'd recommend trying KDAB's GammaRay to watch your application's internals at work.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • H Hubbard

                I had a look through and the line it breaks upon is completely uneventful (literally writing a string to qDebug(), which, to my knowledge, shouldn't crash anything).

                0_1524947591765_1a51bbe5-cf7d-434e-a5e9-e300def79c01-image.png

                This is how my program works, components emit signals to each other and the target components emit more signals of processed information until its stored in that heap there in memory or a component emits a finish signal to the PC, so there is no real program flow just lots of classes interrupting each other, this is why the call stack is so huge I think. Is this a problem?

                W Offline
                W Offline
                wrosecrans
                wrote on last edited by
                #15

                @Hubbard said in Qt crashing for larger programs?:

                This is how my program works, components emit signals to each other and the target components emit more signals of processed information until its stored in that heap there in memory or a component emits a finish signal to the PC, so there is no real program flow just lots of classes interrupting each other, this is why the call stack is so huge I think. Is this a problem?

                That definitely sounds like a problem. It's not that the program has no flow -- it's just that you haven't reasoned about what the flow is, or why it should be that way.

                H 1 Reply Last reply
                0
                • W wrosecrans

                  @Hubbard said in Qt crashing for larger programs?:

                  This is how my program works, components emit signals to each other and the target components emit more signals of processed information until its stored in that heap there in memory or a component emits a finish signal to the PC, so there is no real program flow just lots of classes interrupting each other, this is why the call stack is so huge I think. Is this a problem?

                  That definitely sounds like a problem. It's not that the program has no flow -- it's just that you haven't reasoned about what the flow is, or why it should be that way.

                  H Offline
                  H Offline
                  Hubbard
                  wrote on last edited by
                  #16

                  @wrosecrans
                  I cannot think of a better way of simulating digital electronics though, I've wracked my brain thinking how I can do this without signals and slots in between classes and that go on to trigger more but I can't think of one

                  W 1 Reply Last reply
                  0
                  • H Hubbard

                    This is unlikely to be pointer related because as of the crash the example program was executing a task that it had done 41 times before.

                    JKSHJ Offline
                    JKSHJ Offline
                    JKSH
                    Moderators
                    wrote on last edited by JKSH
                    #17

                    @Hubbard said in Qt crashing for larger programs?:

                    as of the crash the example program was executing a task that it had done 41 times before.

                    This sounds like a classic case of memory corruption.

                    This is unlikely to be pointer related because...

                    It doesn't need to be pointer-related. Memory corruption can come through other ways too (for example, reading/writing past the last element in a raw C array)

                    @Hubbard said in Qt crashing for larger programs?:

                    memory = new Word[300];

                    This is a raw C array, allocated on the heap.

                    I don't know if this is related to your problem or not, but I recommend using QVector or std::vector instread. They have more safeguards built-in than a raw array (for example, you will get an assertion failure if you read beyond the end of the array in Debug mode).

                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                    1 Reply Last reply
                    3
                    • H Hubbard

                      @wrosecrans
                      I cannot think of a better way of simulating digital electronics though, I've wracked my brain thinking how I can do this without signals and slots in between classes and that go on to trigger more but I can't think of one

                      W Offline
                      W Offline
                      wrosecrans
                      wrote on last edited by
                      #18

                      I cannot think of a better way of simulating digital electronics though, I've wracked my brain thinking how I can do this without signals and slots in between classes and that go on to trigger more but I can't think of one

                      Something like a CPU has a synchronous clock, so it would normally be done as a loop that uses a fixed amount of resources per-iteration. Each functional unit sets a flag or something, and the functional unit that would be responding to the signal would handle it in the next iteration. A real piece of silicon doesn't use more and more stuff as time goes by, so the software version shouldn't either. The way you are describing your signals and slots system, everything gets so deep that nothing ever returns and gets back to where it started, so the first step can't finish until everything is finished.

                      H 1 Reply Last reply
                      0
                      • W wrosecrans

                        I cannot think of a better way of simulating digital electronics though, I've wracked my brain thinking how I can do this without signals and slots in between classes and that go on to trigger more but I can't think of one

                        Something like a CPU has a synchronous clock, so it would normally be done as a loop that uses a fixed amount of resources per-iteration. Each functional unit sets a flag or something, and the functional unit that would be responding to the signal would handle it in the next iteration. A real piece of silicon doesn't use more and more stuff as time goes by, so the software version shouldn't either. The way you are describing your signals and slots system, everything gets so deep that nothing ever returns and gets back to where it started, so the first step can't finish until everything is finished.

                        H Offline
                        H Offline
                        Hubbard
                        wrote on last edited by
                        #19

                        @wrosecrans

                        Yeah I solved the problem. The PC emits the next address inside a while(1) loop contained within the computer, meaning the call stack can go back and tie up any loose ends.

                        One thing that can be gained here is... be careful with the call stack and don't create programs relying on endless loops of functions.

                        1 Reply Last reply
                        1

                        • Login

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