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
Qt 6.11 is out! See what's new in the release blog

Qt Application Slowing Down

Scheduled Pinned Locked Moved Solved General and Desktop
47 Posts 7 Posters 7.9k 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.
  • 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
    • S swansorter

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

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

      @swansorter
      well first of all you can clean up the places where newing is not needed.
      All places where you use exec() for dialogs could just be

      void class::insomefunc() {
      mainSortDialog ms;
      this->close();//closes the setting screen
      ms->exec();
      }
      

      and it would be cleaned up as soon as dialog is closed.
      So unless you are not using exec() there should be no reason to new it.
      and hence that could auto clean lots for you.

      S 1 Reply Last reply
      2
      • mrjjM mrjj

        @swansorter
        well first of all you can clean up the places where newing is not needed.
        All places where you use exec() for dialogs could just be

        void class::insomefunc() {
        mainSortDialog ms;
        this->close();//closes the setting screen
        ms->exec();
        }
        

        and it would be cleaned up as soon as dialog is closed.
        So unless you are not using exec() there should be no reason to new it.
        and hence that could auto clean lots for you.

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

        @mrjj i tried this one ... working for me
        thank you

        mrjjM 1 Reply Last reply
        2
        • S swansorter

          @mrjj i tried this one ... working for me
          thank you

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

          @swansorter
          Good. hopefully it can also cure the leaking.

          S 1 Reply Last reply
          0
          • mrjjM mrjj

            @swansorter
            Good. hopefully it can also cure the leaking.

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

            @mrjj i used breakpoints on distructor
            if i use close()...they are not freed
            only if remove close()....they get cleared

            mrjjM 1 Reply Last reply
            0
            • S swansorter

              @mrjj i used breakpoints on distructor
              if i use close()...they are not freed
              only if remove close()....they get cleared

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

              @swansorter

              Im not sure in what context.

              if using something like

              void class::insomefunc() {
              mainSortDialog ms;
              this->close();//closes the setting screen
              ms->exec();
              }

              MS should always be deleted. the this->close() should have no effect.

              If you use new for other classes make sure it still has WA_DeleteOnClose.

              S 1 Reply Last reply
              1
              • mrjjM mrjj

                @swansorter

                Im not sure in what context.

                if using something like

                void class::insomefunc() {
                mainSortDialog ms;
                this->close();//closes the setting screen
                ms->exec();
                }

                MS should always be deleted. the this->close() should have no effect.

                If you use new for other classes make sure it still has WA_DeleteOnClose.

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

                @mrjj
                am using this one move to main sort
                void class::insomefunc() {
                mainSortDialog ms;
                ms->exec();
                }
                and back to main screen by using just "hide();" in back button
                this is work for me even the memory leakage.
                but if use close(); its not working
                void class::insomefunc() {
                mainSortDialog ms;
                this->close();//closes the setting screen
                ms->exec();
                }

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

                  hi
                  in what way "not working" ?

                  S 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    hi
                    in what way "not working" ?

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

                    @mrjj
                    1.i used breakpoints on distructor of each screen.
                    2.am moving to main sort using
                    void class::insomefunc() {
                    mainSortDialog ms;
                    this->close();//closes the setting screen
                    ms->exec();
                    }
                    3.and moving back to the home page
                    void class::insomefunc() {
                    homeDialog h;
                    this->close();//closes the setting screen
                    h->exec();
                    }
                    at this point it is not moving to destructor
                    only if i move to mainwindow it moving to destructor mainsort page

                    mrjjM 1 Reply Last reply
                    0
                    • S swansorter

                      @mrjj
                      1.i used breakpoints on distructor of each screen.
                      2.am moving to main sort using
                      void class::insomefunc() {
                      mainSortDialog ms;
                      this->close();//closes the setting screen
                      ms->exec();
                      }
                      3.and moving back to the home page
                      void class::insomefunc() {
                      homeDialog h;
                      this->close();//closes the setting screen
                      h->exec();
                      }
                      at this point it is not moving to destructor
                      only if i move to mainwindow it moving to destructor mainsort page

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

                      @swansorter
                      Hi
                      Really?
                      but they are local variables. they will be destroyed.
                      I can't see anyway, they could avoid that.

                      jsulmJ 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @swansorter
                        Hi
                        Really?
                        but they are local variables. they will be destroyed.
                        I can't see anyway, they could avoid that.

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

                        @mrjj said in Qt Application Slowing Down:

                        will be destroyed

                        Yes, but only when exec() finishes I guess :-)

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

                        mrjjM 1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @mrjj said in Qt Application Slowing Down:

                          will be destroyed

                          Yes, but only when exec() finishes I guess :-)

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

                          @jsulm
                          Indeed :)
                          I also wondered if this->close() would kill the containing class but
                          i dont see the local dialogs dtor being skipped.

                          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