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 Application Slowing Down
Forum Updated to NodeBB v4.3 + New Features

Qt Application Slowing Down

Scheduled Pinned Locked Moved Solved General and Desktop
47 Posts 7 Posters 7.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.
  • S Offline
    S Offline
    swansorter
    wrote on last edited by
    #17

    valgrind output
    0_1563014260823_Screenshot from 2019-07-13 16-06-28-min.png

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #18

      First please don't post screenshots!
      Second as you can see there are 4GB of allocated memory. So it looks like you're allocating memory but forgot to delete them somewhere.

      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
      4
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #19

        Hi
        Do you use any images in your app ? load them etc ?
        Not icons but huge images or similar ?
        To use 4GB you have to have something a bit heavy as
        clicking back and forth to leak that much using only widgets seems
        to would take a long time.
        You have to look over all places again and try to guess where it is not assigned a parent
        and/or not flagged for delete on close.

        S 1 Reply Last reply
        1
        • mrjjM mrjj

          Hi
          Do you use any images in your app ? load them etc ?
          Not icons but huge images or similar ?
          To use 4GB you have to have something a bit heavy as
          clicking back and forth to leak that much using only widgets seems
          to would take a long time.
          You have to look over all places again and try to guess where it is not assigned a parent
          and/or not flagged for delete on close.

          S Offline
          S Offline
          swansorter
          wrote on last edited by
          #20

          @mrjj yess am using 12kb size image

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #21

            Hi
            ok that's not so much.
            look for new in loop and such places.

            How fast does it take to get "slow" ?

            S 1 Reply Last reply
            0
            • mrjjM mrjj

              Hi
              ok that's not so much.
              look for new in loop and such places.

              How fast does it take to get "slow" ?

              S Offline
              S Offline
              swansorter
              wrote on last edited by swansorter
              #22

              @mrjj within 5 min it starts getting slow
              once i got to main window application works normal speed for another 5 min
              and again if i back and forth the some other dialog it become slower

              mrjjM 1 Reply Last reply
              0
              • S swansorter

                @mrjj within 5 min it starts getting slow
                once i got to main window application works normal speed for another 5 min
                and again if i back and forth the some other dialog it become slower

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

                @swansorter
                Ok. That's pretty fast.
                Does seems related to navigating the app.
                I would set breakpoints in all dialogs destructors to make sure they are deleted.
                and generally, look over the code verify that you free stuff.

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

                  Hi,

                  From the look of the code you posted, you are re-creating at least your main window each time you call your settings dialog. If you do that with all your dialogs and maybe other widgets, it's not really surprising that the memory gets eaten up.

                  You should take a look at the more complex Qt example on how to handle a QMainWindow with one or more dialogs.

                  Still based on your code and ve fact that you are using images, how are you handling them ?

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

                  S 1 Reply Last reply
                  4
                  • SGaistS SGaist

                    Hi,

                    From the look of the code you posted, you are re-creating at least your main window each time you call your settings dialog. If you do that with all your dialogs and maybe other widgets, it's not really surprising that the memory gets eaten up.

                    You should take a look at the more complex Qt example on how to handle a QMainWindow with one or more dialogs.

                    Still based on your code and ve fact that you are using images, how are you handling them ?

                    S Offline
                    S Offline
                    swansorter
                    wrote on last edited by
                    #25

                    @SGaist i searched but found nothing ...
                    please share the link of any Qt example program

                    1 Reply Last reply
                    0
                    • Christian EhrlicherC Offline
                      Christian EhrlicherC Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on last edited by
                      #26

                      @swansorter said in Qt Application Slowing Down:

                      please share the link of any Qt example program

                      https://doc.qt.io/qt-5/examples-widgets.html

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

                      S 1 Reply Last reply
                      2
                      • Christian EhrlicherC Christian Ehrlicher

                        @swansorter said in Qt Application Slowing Down:

                        please share the link of any Qt example program

                        https://doc.qt.io/qt-5/examples-widgets.html

                        S Offline
                        S Offline
                        swansorter
                        wrote on last edited by
                        #27

                        @Christian-Ehrlicher i need example like QMainWindow with two or more dialogs.

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

                          Having two dialogs or one doesn't change things much.

                          What do you search exactly with an example with two dialogs ?

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

                          S 1 Reply Last reply
                          1
                          • SGaistS SGaist

                            Having two dialogs or one doesn't change things much.

                            What do you search exactly with an example with two dialogs ?

                            S Offline
                            S Offline
                            swansorter
                            wrote on last edited by
                            #29

                            @SGaist yea...qt dialog with more than two dialog

                            jsulmJ 1 Reply Last reply
                            0
                            • S swansorter

                              @SGaist yea...qt dialog with more than two dialog

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #30

                              @swansorter If you can create one dialog you can create 2 or 3 or 4 or ...
                              So, what exactly is the problem?

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              S 1 Reply Last reply
                              0
                              • jsulmJ jsulm

                                @swansorter If you can create one dialog you can create 2 or 3 or 4 or ...
                                So, what exactly is the problem?

                                S Offline
                                S Offline
                                swansorter
                                wrote on last edited by
                                #31

                                @jsulm 1. we have different screens like home screen ,setting screen ,main sort screen , resort1 ,resort2 and resort 3 screens
                                2.On "home screen" we have setting button.
                                3.we move to the "setting screen" with code like the following:-

                                settingDialog *sd=new settingDialog(this);
                                sd->setModal(true);
                                close(); //closes the home window
                                sd->setAttribute( Qt::WA_DeleteOnClose);
                                sd->exec();//shows the setting screen
                                

                                4.On "Setting screen" we have main sort screen Button ,resort1 ,2 ,3 screen buttons to move respective screens.

                                5.we move to the "main sort screen" with code like the following:-

                                mainSortDialog *ms=new mainSortDialog();
                                ms->setModal(true);
                                ms->setAttribute ( Qt::WA_DeleteOnClose, true );
                                this->close();//closes the setting screen
                                ms->exec();//shows the main sort window

                                6.on "main sort screen" we have Back button to go back to "setting screen".

                                1. we move to the "main sort screen" with code like the following:-

                                  sd=new settingDialog();
                                  sd->setAttribute ( Qt::WA_DeleteOnClose, true );
                                  sd->setModal(true);
                                  this->close();//closes the main sort screen
                                  sd->exec();//shows the setting screen

                                8.if i do the step 5 and 7 continuously the application gets slower .

                                jsulmJ 1 Reply Last reply
                                0
                                • S swansorter

                                  @jsulm 1. we have different screens like home screen ,setting screen ,main sort screen , resort1 ,resort2 and resort 3 screens
                                  2.On "home screen" we have setting button.
                                  3.we move to the "setting screen" with code like the following:-

                                  settingDialog *sd=new settingDialog(this);
                                  sd->setModal(true);
                                  close(); //closes the home window
                                  sd->setAttribute( Qt::WA_DeleteOnClose);
                                  sd->exec();//shows the setting screen
                                  

                                  4.On "Setting screen" we have main sort screen Button ,resort1 ,2 ,3 screen buttons to move respective screens.

                                  5.we move to the "main sort screen" with code like the following:-

                                  mainSortDialog *ms=new mainSortDialog();
                                  ms->setModal(true);
                                  ms->setAttribute ( Qt::WA_DeleteOnClose, true );
                                  this->close();//closes the setting screen
                                  ms->exec();//shows the main sort window

                                  6.on "main sort screen" we have Back button to go back to "setting screen".

                                  1. we move to the "main sort screen" with code like the following:-

                                    sd=new settingDialog();
                                    sd->setAttribute ( Qt::WA_DeleteOnClose, true );
                                    sd->setModal(true);
                                    this->close();//closes the main sort screen
                                    sd->exec();//shows the setting screen

                                  8.if i do the step 5 and 7 continuously the application gets slower .

                                  jsulmJ Offline
                                  jsulmJ Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by jsulm
                                  #32

                                  @swansorter said in Qt Application Slowing Down:

                                  if i do the step 5 and 7 continuously the application gets slower

                                  Then you have to investigate.
                                  Did you check CPU usage of your app?
                                  Did you check RAM usage of your app?

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0
                                  • mrjjM Offline
                                    mrjjM Offline
                                    mrjj
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #33

                                    Hi
                                    Also did you CHECK that your dialogs are in fact - deleted?
                                    By breakpoints in their destructors.
                                    WA_DeleteOnClose should take care of that but its good to check.

                                    S 1 Reply Last reply
                                    0
                                    • mrjjM mrjj

                                      Hi
                                      Also did you CHECK that your dialogs are in fact - deleted?
                                      By breakpoints in their destructors.
                                      WA_DeleteOnClose should take care of that but its good to check.

                                      S Offline
                                      S Offline
                                      swansorter
                                      wrote on last edited by swansorter
                                      #34

                                      @mrjj yea checked.....execution of destructors are happening only when i moved to main window

                                      mrjjM 1 Reply Last reply
                                      0
                                      • S swansorter

                                        @mrjj yea checked.....execution of destructors are happening only when i moved to main window

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

                                        @swansorter

                                        Well is that the issue then?
                                        If you dont move to mainwin, they are not freed,
                                        so if u never do that then it grows.
                                        or ?

                                        S 1 Reply Last reply
                                        0
                                        • mrjjM mrjj

                                          @swansorter

                                          Well is that the issue then?
                                          If you dont move to mainwin, they are not freed,
                                          so if u never do that then it grows.
                                          or ?

                                          S Offline
                                          S Offline
                                          swansorter
                                          wrote on last edited by
                                          #36

                                          @mrjj yes that is the issu..
                                          how to free the object when the perticular screen "dialog" close?

                                          mrjjM 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