Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Memory (?) woes
Qt 6.12 LTS is out! See what's new in the release blog

Memory (?) woes

Scheduled Pinned Locked Moved Unsolved General and Desktop
23 Posts 4 Posters 14.7k Views 2 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

    Hi
    What does your app do ?
    When you app lags. if you start some other program, does that run as expected?

    deisikD Offline
    deisikD Offline
    deisik
    wrote on last edited by
    #3

    @mrjj

    It sends and receives some data to and from network (mostly receives and shows). It doesn't work with disk, and there are no disk operations going on when my app freezes (I can see that in the VMware console) if that was your point

    mrjjM 1 Reply Last reply
    0
    • deisikD deisik

      @mrjj

      It sends and receives some data to and from network (mostly receives and shows). It doesn't work with disk, and there are no disk operations going on when my app freezes (I can see that in the VMware console) if that was your point

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

      @deisik
      Well i'm just fishing for any reasonable explanation on how two browsers could have any influence your other app.
      Since you app seems low mem ( < 100 MB ) its not from virtual mem paging directly.
      You could try disable virtual memory in guest to check its not related to paging.

      Also, is it possible to provoke this effect with non network apps ?
      Like using consume.exe
      https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=17657
      or
      https://blogs.msdn.microsoft.com/vijaysk/2012/10/26/tools-to-simulate-cpu-memory-disk-load/

      deisikD 1 Reply Last reply
      3
      • mrjjM mrjj

        @deisik
        Well i'm just fishing for any reasonable explanation on how two browsers could have any influence your other app.
        Since you app seems low mem ( < 100 MB ) its not from virtual mem paging directly.
        You could try disable virtual memory in guest to check its not related to paging.

        Also, is it possible to provoke this effect with non network apps ?
        Like using consume.exe
        https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=17657
        or
        https://blogs.msdn.microsoft.com/vijaysk/2012/10/26/tools-to-simulate-cpu-memory-disk-load/

        deisikD Offline
        deisikD Offline
        deisik
        wrote on last edited by deisik
        #5

        @mrjj

        It seems to be related to memory allocation since my app constantly creates small objects as it receives data from the network (they are to stay in memory till the program is closed). I don't know while allocating more heap doesn't work though

        mrjjM 1 Reply Last reply
        0
        • deisikD deisik

          @mrjj

          It seems to be related to memory allocation since my app constantly creates small objects as it receives data from the network (they are to stay in memory till the program is closed). I don't know while allocating more heap doesn't work though

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

          @deisik
          well if you don't new/delete all the time it rules out fragmentation.

          what happens if u decrease the memory for the guest. Just Like when the hogs are doing it?

          deisikD 1 Reply Last reply
          0
          • mrjjM mrjj

            @deisik
            well if you don't new/delete all the time it rules out fragmentation.

            what happens if u decrease the memory for the guest. Just Like when the hogs are doing it?

            deisikD Offline
            deisikD Offline
            deisik
            wrote on last edited by deisik
            #7

            @mrjj

            I've reduced memory to 2Gb and started only Firefox now. Now I have problems with browsing but my app works fine so far. I guess memory fragmentation is the main cause behind the lags since I do create and destroy objects all the time. And with more data received from the network the temporary data structures used for processing this data become bigger and bigger (though they are certainly not big in absolute terms). I thought increasing the heap size would help but it didn't (or it didn't get increased)

            Is there a simple way to resolve this issue (and check how much heap the app actually uses)?

            Update: I'm back to 4GB

            jsulmJ 1 Reply Last reply
            0
            • deisikD deisik

              @mrjj

              I've reduced memory to 2Gb and started only Firefox now. Now I have problems with browsing but my app works fine so far. I guess memory fragmentation is the main cause behind the lags since I do create and destroy objects all the time. And with more data received from the network the temporary data structures used for processing this data become bigger and bigger (though they are certainly not big in absolute terms). I thought increasing the heap size would help but it didn't (or it didn't get increased)

              Is there a simple way to resolve this issue (and check how much heap the app actually uses)?

              Update: I'm back to 4GB

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

              @deisik Are you sure it is related to RAM and not CPU load? Firefox can consume a lot of CPU depending on websites loaded.

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

              deisikD 1 Reply Last reply
              0
              • jsulmJ jsulm

                @deisik Are you sure it is related to RAM and not CPU load? Firefox can consume a lot of CPU depending on websites loaded.

                deisikD Offline
                deisikD Offline
                deisik
                wrote on last edited by deisik
                #9

                @jsulm

                No, this has nothing to do with CPU load. Anyway, I have 4 cores in the guest and 8 cores physical, so this is not an issue. When my app freezes there are no hikes in CPU load, in any program. The system is fully responsive as well as everything else apart from my app. In these moments it looks as if covered by a white veil with a round "busy" Windows cursor over it. Sometimes there is no white veil at all, just a "busy" cursor

                jsulmJ 1 Reply Last reply
                0
                • deisikD deisik

                  @jsulm

                  No, this has nothing to do with CPU load. Anyway, I have 4 cores in the guest and 8 cores physical, so this is not an issue. When my app freezes there are no hikes in CPU load, in any program. The system is fully responsive as well as everything else apart from my app. In these moments it looks as if covered by a white veil with a round "busy" Windows cursor over it. Sometimes there is no white veil at all, just a "busy" cursor

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

                  @deisik You said your app uses network - this could be another thing to check. Depending on how you implemented the networking in your app it could be blocked while waiting fore response for example.
                  Did you test your app on a real hardware?

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

                  deisikD 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @deisik You said your app uses network - this could be another thing to check. Depending on how you implemented the networking in your app it could be blocked while waiting fore response for example.
                    Did you test your app on a real hardware?

                    deisikD Offline
                    deisikD Offline
                    deisik
                    wrote on last edited by deisik
                    #11

                    @jsulm

                    I'm running network in asynchronous mode so there can hardly be such issues. If it were network, then closing browsers (and freeing memory) wouldn't change anything, right? It is obviously related to memory allocation or memory fragmentation due to a lot of new/delete operations. Yes, I run the same code on Linux (which is the host), but not as extensively, and I didn't see anything like that there

                    kshegunovK 1 Reply Last reply
                    0
                    • deisikD deisik

                      @jsulm

                      I'm running network in asynchronous mode so there can hardly be such issues. If it were network, then closing browsers (and freeing memory) wouldn't change anything, right? It is obviously related to memory allocation or memory fragmentation due to a lot of new/delete operations. Yes, I run the same code on Linux (which is the host), but not as extensively, and I didn't see anything like that there

                      kshegunovK Offline
                      kshegunovK Offline
                      kshegunov
                      Moderators
                      wrote on last edited by kshegunov
                      #12

                      Have you disabled paging on your guest? Try doing that and see if anything pops up. Be aware that doing this will cause exhausting the available memory to wreak all kinds of havoc on the running application(s). But at least should give you some idea whether memory access speed is the culprit.

                      Read and abide by the Qt Code of Conduct

                      deisikD 1 Reply Last reply
                      0
                      • kshegunovK kshegunov

                        Have you disabled paging on your guest? Try doing that and see if anything pops up. Be aware that doing this will cause exhausting the available memory to wreak all kinds of havoc on the running application(s). But at least should give you some idea whether memory access speed is the culprit.

                        deisikD Offline
                        deisikD Offline
                        deisik
                        wrote on last edited by deisik
                        #13

                        @kshegunov

                        If it were swapping I would see that in the Virtual Machine console, but there is nothing. Moreover, I still have about 1Gb of RAM free as shown by the Windows Task Manager. Just in case, in VMware preferences I set the option to fit all virtual machine memory into reserved host RAM. Host RAM for virtual machines is set to maximum and equals almost 14 Gb. There are no other virtual machines running

                        kshegunovK 1 Reply Last reply
                        0
                        • deisikD deisik

                          @kshegunov

                          If it were swapping I would see that in the Virtual Machine console, but there is nothing. Moreover, I still have about 1Gb of RAM free as shown by the Windows Task Manager. Just in case, in VMware preferences I set the option to fit all virtual machine memory into reserved host RAM. Host RAM for virtual machines is set to maximum and equals almost 14 Gb. There are no other virtual machines running

                          kshegunovK Offline
                          kshegunovK Offline
                          kshegunov
                          Moderators
                          wrote on last edited by
                          #14

                          @deisik said in Memory (?) woes:

                          If it were swapping I would see that in the Virtual Machine console,

                          Why? You mean to say that the virtual machine console will tell you all the HDD read/writes occurring with their sources, or that the VM console tracks windows' internals to know when the OS decides to swap?
                          The guest system is oblivious that it's running on a virtual machine, additionally windows can decide to swap before exhausting all the memory (which is actually the case), it's not something you can control.

                          Read and abide by the Qt Code of Conduct

                          deisikD 1 Reply Last reply
                          0
                          • kshegunovK kshegunov

                            @deisik said in Memory (?) woes:

                            If it were swapping I would see that in the Virtual Machine console,

                            Why? You mean to say that the virtual machine console will tell you all the HDD read/writes occurring with their sources, or that the VM console tracks windows' internals to know when the OS decides to swap?
                            The guest system is oblivious that it's running on a virtual machine, additionally windows can decide to swap before exhausting all the memory (which is actually the case), it's not something you can control.

                            deisikD Offline
                            deisikD Offline
                            deisik
                            wrote on last edited by deisik
                            #15

                            @kshegunov

                            I can easily see disk operations in the VM Console (when disks are accessed the disk icons blink and it is obvious that disks are rarely accessed), irrespective of whether Windows uses swap or not. Anyway, this would affect all programs, especially those browsers which are eating over 1Gb each but they are working fine. In short, this is not a memory swap issue, I certainly know how it feels when Windows starts swapping heavily. I've checked that the first thing

                            kshegunovK 1 Reply Last reply
                            0
                            • deisikD deisik

                              @kshegunov

                              I can easily see disk operations in the VM Console (when disks are accessed the disk icons blink and it is obvious that disks are rarely accessed), irrespective of whether Windows uses swap or not. Anyway, this would affect all programs, especially those browsers which are eating over 1Gb each but they are working fine. In short, this is not a memory swap issue, I certainly know how it feels when Windows starts swapping heavily. I've checked that the first thing

                              kshegunovK Offline
                              kshegunovK Offline
                              kshegunov
                              Moderators
                              wrote on last edited by kshegunov
                              #16

                              Fine.
                              Do you use threading in your application and if you do, how do you do it? Are you making sure you're not blocking the GUI thread's event loop?

                              PS.
                              You should really attach a debugger to your application while running in the guest system and interrupt the process, then extract a stack trace to see what's going on.

                              Read and abide by the Qt Code of Conduct

                              deisikD 1 Reply Last reply
                              0
                              • kshegunovK kshegunov

                                Fine.
                                Do you use threading in your application and if you do, how do you do it? Are you making sure you're not blocking the GUI thread's event loop?

                                PS.
                                You should really attach a debugger to your application while running in the guest system and interrupt the process, then extract a stack trace to see what's going on.

                                deisikD Offline
                                deisikD Offline
                                deisik
                                wrote on last edited by deisik
                                #17

                                @kshegunov

                                Obviously, networking uses threads but if something would be blocking GUI internally then how Windows would know that? What would I interrupt if it is system related?

                                kshegunovK 1 Reply Last reply
                                0
                                • deisikD deisik

                                  @kshegunov

                                  Obviously, networking uses threads but if something would be blocking GUI internally then how Windows would know that? What would I interrupt if it is system related?

                                  kshegunovK Offline
                                  kshegunovK Offline
                                  kshegunov
                                  Moderators
                                  wrote on last edited by
                                  #18

                                  @deisik said in Memory (?) woes:

                                  but if something would be blocking GUI internally then how Windows would know that?

                                  It won't so it will show a cursor that's spinning around. And if the GUI event loop is blocked, no repainting will be done, so you might see (but not always) a white box instead of your application window. My other advice stands: compile in debug mode (and don't mess with the compilation flags), then run your app through the debugger and see what happens and if the problem manifests itself.

                                  Read and abide by the Qt Code of Conduct

                                  deisikD 1 Reply Last reply
                                  0
                                  • kshegunovK kshegunov

                                    @deisik said in Memory (?) woes:

                                    but if something would be blocking GUI internally then how Windows would know that?

                                    It won't so it will show a cursor that's spinning around. And if the GUI event loop is blocked, no repainting will be done, so you might see (but not always) a white box instead of your application window. My other advice stands: compile in debug mode (and don't mess with the compilation flags), then run your app through the debugger and see what happens and if the problem manifests itself.

                                    deisikD Offline
                                    deisikD Offline
                                    deisik
                                    wrote on last edited by deisik
                                    #19

                                    @kshegunov

                                    And how that would explain that closing browsers fixes this issue? Lags don't happen all the time, they happen completely at random but seem to come in packs

                                    kshegunovK 1 Reply Last reply
                                    0
                                    • deisikD deisik

                                      @kshegunov

                                      And how that would explain that closing browsers fixes this issue? Lags don't happen all the time, they happen completely at random but seem to come in packs

                                      kshegunovK Offline
                                      kshegunovK Offline
                                      kshegunov
                                      Moderators
                                      wrote on last edited by
                                      #20

                                      @deisik said in Memory (?) woes:

                                      And how that would explain that closing browsers fixes this issue?

                                      I'm not selling explanations here, and I'm not about to venture on a speculation expedition. I'm suggesting ways for you to track down your problem, you can take them or not, it's your choice. If you don't want to run everything through the debugger, then start your debug application and wait for the problem, then attach the debugger to the running process and then interrupt it to see what's going on inside.

                                      Read and abide by the Qt Code of Conduct

                                      deisikD 1 Reply Last reply
                                      3
                                      • kshegunovK kshegunov

                                        @deisik said in Memory (?) woes:

                                        And how that would explain that closing browsers fixes this issue?

                                        I'm not selling explanations here, and I'm not about to venture on a speculation expedition. I'm suggesting ways for you to track down your problem, you can take them or not, it's your choice. If you don't want to run everything through the debugger, then start your debug application and wait for the problem, then attach the debugger to the running process and then interrupt it to see what's going on inside.

                                        deisikD Offline
                                        deisikD Offline
                                        deisik
                                        wrote on last edited by deisik
                                        #21

                                        @kshegunov

                                        If it is Windows itself that interrupts my app what will I see in debugger, or will I be able to debug my app (or even stop it before Windows completes whatever it might be doing)?

                                        kshegunovK 1 Reply Last reply
                                        0
                                        • deisikD deisik

                                          @kshegunov

                                          If it is Windows itself that interrupts my app what will I see in debugger, or will I be able to debug my app (or even stop it before Windows completes whatever it might be doing)?

                                          kshegunovK Offline
                                          kshegunovK Offline
                                          kshegunov
                                          Moderators
                                          wrote on last edited by kshegunov
                                          #22

                                          A deep call into the windows' binaries.
                                          You can troll me however much you want, I said what I had in mind, whether you try it out is your own business.

                                          Read and abide by the Qt Code of Conduct

                                          deisikD 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
                                          • Unsolved