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. memory usage with QT Widgets
Forum Updated to NodeBB v4.3 + New Features

memory usage with QT Widgets

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 485 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.
  • P Offline
    P Offline
    pedrito
    wrote on 1 Nov 2022, 09:31 last edited by
    #1

    My app has many forms that Inherits from QWidget.
    I create them and set visibility at false to show only one at a time.
    The memory usage is 1200MB.
    Is this normal with Qt widgets?
    Can I reduce memory usage ?

    Thanks

    J 1 Reply Last reply 1 Nov 2022, 09:38
    0
    • P pedrito
      1 Nov 2022, 09:31

      My app has many forms that Inherits from QWidget.
      I create them and set visibility at false to show only one at a time.
      The memory usage is 1200MB.
      Is this normal with Qt widgets?
      Can I reduce memory usage ?

      Thanks

      J Offline
      J Offline
      JonB
      wrote on 1 Nov 2022, 09:38 last edited by
      #2

      @pedrito
      So your application/widgets occupies 1.2GB you are saying? That seems a lot....

      P 1 Reply Last reply 1 Nov 2022, 11:04
      0
      • J JonB
        1 Nov 2022, 09:38

        @pedrito
        So your application/widgets occupies 1.2GB you are saying? That seems a lot....

        P Offline
        P Offline
        pedrito
        wrote on 1 Nov 2022, 11:04 last edited by
        #3

        @JonB hello Jon!
        I have 100 rows like this:
        pcontainer_panel_map_stc = new container_panel_map_stc();
        pcontainer_panel_map_stc ->hide();

        with different containers, each one inherits from widget and have enbedded widgest.....

        I understand all the allocated memory with so many forms instanciated at start up, but i was wondering if i can do something to reduce memory usage.
        If i do the "new" only to the current visible form, the user will see a delay in the form showing, and i don't want this.
        Do you have some idea?
        thanks !

        J 1 Reply Last reply 1 Nov 2022, 11:16
        0
        • P pedrito
          1 Nov 2022, 11:04

          @JonB hello Jon!
          I have 100 rows like this:
          pcontainer_panel_map_stc = new container_panel_map_stc();
          pcontainer_panel_map_stc ->hide();

          with different containers, each one inherits from widget and have enbedded widgest.....

          I understand all the allocated memory with so many forms instanciated at start up, but i was wondering if i can do something to reduce memory usage.
          If i do the "new" only to the current visible form, the user will see a delay in the form showing, and i don't want this.
          Do you have some idea?
          thanks !

          J Offline
          J Offline
          JonB
          wrote on 1 Nov 2022, 11:16 last edited by
          #4

          @pedrito
          Impossible to say how much memory needed, since you tell me you have 100 rows with "enbedded widgest" but give absolutely no indication how many widgets per row, so no one can say. I am still surprised it occupies 1.2GB, I guess you have tens of hundreds of thousands of widgets...? Seems excessive....

          but i was wondering if i can do something to reduce memory usage.

          If i do the "new" only to the current visible form, the user will see a delay in the form showing, and i don't want this.

          So you would like to reduce the memory usage, but wish to create all the widgets and are not prepared to create/destroy them on demand. You want to have your cake and eat it. You would like to create the hundreds of thousands of widgets on start up but magically have them not take up memory, right? I would try prayer....

          • Create/destroy the widgets on demand to reduce memory.
          • Reduce the total number from the hundreds of thousands you appear to have.
          • Re-use some widgets/containers instead of creating separate ones.
          • Pray for a miracle whereby you allocate all the memory in advance for the widgets yet this miraculously does not use the memory....
          P 1 Reply Last reply 1 Nov 2022, 11:20
          1
          • J JonB
            1 Nov 2022, 11:16

            @pedrito
            Impossible to say how much memory needed, since you tell me you have 100 rows with "enbedded widgest" but give absolutely no indication how many widgets per row, so no one can say. I am still surprised it occupies 1.2GB, I guess you have tens of hundreds of thousands of widgets...? Seems excessive....

            but i was wondering if i can do something to reduce memory usage.

            If i do the "new" only to the current visible form, the user will see a delay in the form showing, and i don't want this.

            So you would like to reduce the memory usage, but wish to create all the widgets and are not prepared to create/destroy them on demand. You want to have your cake and eat it. You would like to create the hundreds of thousands of widgets on start up but magically have them not take up memory, right? I would try prayer....

            • Create/destroy the widgets on demand to reduce memory.
            • Reduce the total number from the hundreds of thousands you appear to have.
            • Re-use some widgets/containers instead of creating separate ones.
            • Pray for a miracle whereby you allocate all the memory in advance for the widgets yet this miraculously does not use the memory....
            P Offline
            P Offline
            pedrito
            wrote on 1 Nov 2022, 11:20 last edited by
            #5

            ok. you are right Jon. Really thank you for the explanation!

            1 Reply Last reply
            1
            • S Offline
              S Offline
              SimonSchroeder
              wrote on 2 Nov 2022, 09:46 last edited by
              #6

              I expect that not all 100 rows are visible at the same time. You should try to only have the widgets allocated/created that are also visible. When you scroll you have to switch out rows to display. Usually, this is also a really bad user experience as it takes to long to open. You app will freeze for seconds and only when all widgets are created will it be responsive to the user again. This is really frustrating for the user. Most users will assume your software is not doing anything anymore and will try to close it and reopen.

              1 Reply Last reply
              0

              1/6

              1 Nov 2022, 09:31

              • Login

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