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

Memory leak

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 5 Posters 1.6k 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.
  • O Offline
    O Offline
    ODБOï
    wrote on 25 Apr 2019, 14:19 last edited by
    #1

    Hi,

    Im developing an application that uses QTCPSockets to communicate with another PC on the same LAN, it works correctly (memory usage 13Mo stable)

    My probleme will apear only if i plug the 2 PCs directly with ethernet cable, my application will work but the memory consumption keeps growing in this case

    What can cause this please ?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      VRonin
      wrote on 25 Apr 2019, 14:40 last edited by
      #2

      Can you try if you can reproduce the same behaviour using this program? Trying to understand if the problem is with the code or if it goes deeper

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      O 1 Reply Last reply 25 Apr 2019, 15:39
      6
      • V VRonin
        25 Apr 2019, 14:40

        Can you try if you can reproduce the same behaviour using this program? Trying to understand if the problem is with the code or if it goes deeper

        O Offline
        O Offline
        ODБOï
        wrote on 25 Apr 2019, 15:39 last edited by ODБOï
        #3

        @VRonin thank you very much!
        the Qt Simple Chat Example works nicely ... LAN and Direct, that means 'my' code is in cause.

        My app is based on this VNC/rfb implementation made with Qt https://bitbucket.org/amahta/qvncclient/src
        I will dig this tomorrow...

        A 1 Reply Last reply 25 Apr 2019, 17:13
        0
        • O ODБOï
          25 Apr 2019, 15:39

          @VRonin thank you very much!
          the Qt Simple Chat Example works nicely ... LAN and Direct, that means 'my' code is in cause.

          My app is based on this VNC/rfb implementation made with Qt https://bitbucket.org/amahta/qvncclient/src
          I will dig this tomorrow...

          A Offline
          A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on 25 Apr 2019, 17:13 last edited by
          #4

          @LeLev I once had QTcpSocket memory problems in a DLL without Qt event loop.

          Don't know if that apllies to your case...

          Qt has to stay free or it will die.

          O 1 Reply Last reply 25 Apr 2019, 19:59
          1
          • A aha_1980
            25 Apr 2019, 17:13

            @LeLev I once had QTcpSocket memory problems in a DLL without Qt event loop.

            Don't know if that apllies to your case...

            O Offline
            O Offline
            ODБOï
            wrote on 25 Apr 2019, 19:59 last edited by
            #5

            @aha_1980 thank you for the clue, I have simple widget app with event loop in the main.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              Kent-Dorfman
              wrote on 26 Apr 2019, 04:11 last edited by
              #6

              The thing to keep in mind about TCP connections is that they don't immediately free resources when the connection is closed, or worse, folks will simply terminate the connection without cleaning up the session. In these cases you may see resources reserved until the connection overruns the default TCP timeout value. When this is noticeable is when a machine spawns many short lived sessions with other machines.

              Are you explicitly closing the connections or are you simply letting the object destructor do it for you behind the scenes?

              1 Reply Last reply
              1
              • O Offline
                O Offline
                ODБOï
                wrote on 26 Apr 2019, 07:34 last edited by ODБOï
                #7

                hi @Kent-Dorfman, the qvncclient uses only one QTCPSocket, and the session needs to be closed only when i exit the application.
                Is there a reason that the behavior is not the same with LAN or Direct cable connexions ?
                THX

                edit:
                when i unplug the pc where the vnc server is (ultraVnc) from the LAN and plug it to the client (my app) PC directly, the server pc gets automatic ip adress, So i put my PC (client) to static adress on the same network to be able to connect.

                Is it possible i have to much information comming from the server to my client with direct cable ?
                Even Wireshark (running client side) hangs periodically ..

                J 1 Reply Last reply 26 Apr 2019, 07:53
                0
                • O ODБOï
                  26 Apr 2019, 07:34

                  hi @Kent-Dorfman, the qvncclient uses only one QTCPSocket, and the session needs to be closed only when i exit the application.
                  Is there a reason that the behavior is not the same with LAN or Direct cable connexions ?
                  THX

                  edit:
                  when i unplug the pc where the vnc server is (ultraVnc) from the LAN and plug it to the client (my app) PC directly, the server pc gets automatic ip adress, So i put my PC (client) to static adress on the same network to be able to connect.

                  Is it possible i have to much information comming from the server to my client with direct cable ?
                  Even Wireshark (running client side) hangs periodically ..

                  J Online
                  J Online
                  JonB
                  wrote on 26 Apr 2019, 07:53 last edited by
                  #8

                  @LeLev said in Memory leak:

                  Even Wireshark (running client side) hangs periodically ..

                  That sounds very odd! Millions(!?) of people use Wireshark, I would think we'd know about that. I'm sure it will not have problems keeping up with ethernet cable speed. You might Google for that to make sure.

                  1 Reply Last reply
                  1
                  • O Offline
                    O Offline
                    ODБOï
                    wrote on 26 Apr 2019, 08:23 last edited by
                    #9

                    @JonB hi,
                    The problem comes from the lib qvncclient i use and maybe the protocol (rfb) itself no ? because the program @VRonin gave me worked perfectly...
                    I did lot of Google this 2 days for this, but im afraid there is no topics really related

                    I'm very much curious about why this is happening with direct cable and not when there are Servers/switches between.. Can it be possible that servers are queuing data, but in case of direct ethernet cable i'm reciving too much ?

                    I use the direct cable solution because my client app needs to auto-connect to the server, so i need to know the server IP adress.

                    I will try to look for another solution to find the ip adress of the server i think...
                    Does someone have a suggestion for this ?

                    There are maybe 150 PCs on the network, how to find the only one that has my VNC server running on ?

                    Thank you

                    V 1 Reply Last reply 26 Apr 2019, 08:28
                    0
                    • O ODБOï
                      26 Apr 2019, 08:23

                      @JonB hi,
                      The problem comes from the lib qvncclient i use and maybe the protocol (rfb) itself no ? because the program @VRonin gave me worked perfectly...
                      I did lot of Google this 2 days for this, but im afraid there is no topics really related

                      I'm very much curious about why this is happening with direct cable and not when there are Servers/switches between.. Can it be possible that servers are queuing data, but in case of direct ethernet cable i'm reciving too much ?

                      I use the direct cable solution because my client app needs to auto-connect to the server, so i need to know the server IP adress.

                      I will try to look for another solution to find the ip adress of the server i think...
                      Does someone have a suggestion for this ?

                      There are maybe 150 PCs on the network, how to find the only one that has my VNC server running on ?

                      Thank you

                      V Offline
                      V Offline
                      VRonin
                      wrote on 26 Apr 2019, 08:28 last edited by
                      #10

                      @LeLev said in Memory leak:

                      There are maybe 150 PCs on the network, how to find the only one that has my VNC server running on ?

                      If it's on LAN just have the client broadcast a UDP message to the entire network and have the server detect it and respond by communicating its IP

                      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                      ~Napoleon Bonaparte

                      On a crusade to banish setIndexWidget() from the holy land of Qt

                      1 Reply Last reply
                      3
                      • O Offline
                        O Offline
                        ODБOï
                        wrote on 26 Apr 2019, 08:35 last edited by ODБOï
                        #11

                        @VRonin yes i did that already,
                        but the server is a 3rd party app, i can not write code in it.

                        So i did a little Qt program that :

                        • starts with the server

                        • wait the message "Yourip"

                        • gives its ip and closes.

                        i wonder if there is better solution (witout additional app)

                        edit :
                        The server will always run on the same pc. I will try to use the PCs (server) name to get its ip via DNS directly

                        Thank you

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          Kent-Dorfman
                          wrote on 26 Apr 2019, 14:18 last edited by
                          #12

                          If I had to venture a guess...you are effectively ending up with a routing loop so that connections and traffic are showing up multiple times at the NIC when you do the point-to-point configuration. To diagnose this sort of issue requires a good understanding of IP routing. and you don't mention the OS. I trust the TCP stack in Linux far more than I do the one in Windoze.

                          K 1 Reply Last reply 26 Apr 2019, 14:24
                          1
                          • K Kent-Dorfman
                            26 Apr 2019, 14:18

                            If I had to venture a guess...you are effectively ending up with a routing loop so that connections and traffic are showing up multiple times at the NIC when you do the point-to-point configuration. To diagnose this sort of issue requires a good understanding of IP routing. and you don't mention the OS. I trust the TCP stack in Linux far more than I do the one in Windoze.

                            K Offline
                            K Offline
                            Kent-Dorfman
                            wrote on 26 Apr 2019, 14:24 last edited by
                            #13

                            Output of these commands while your app is running in point-to-point?

                            ifconfig -a
                            netstat -rn
                            netstat -an

                            wait for memory usage to increase and then another
                            netstat -an

                            exit program, wait 30 seconds, and do another netstat -an again

                            You're looking for possible routing loops, IP conflicts, or queued connections.

                            Also make sure to test your program using the expected IP number, not the DNS name.

                            O 1 Reply Last reply 26 Apr 2019, 19:38
                            4
                            • K Kent-Dorfman
                              26 Apr 2019, 14:24

                              Output of these commands while your app is running in point-to-point?

                              ifconfig -a
                              netstat -rn
                              netstat -an

                              wait for memory usage to increase and then another
                              netstat -an

                              exit program, wait 30 seconds, and do another netstat -an again

                              You're looking for possible routing loops, IP conflicts, or queued connections.

                              Also make sure to test your program using the expected IP number, not the DNS name.

                              O Offline
                              O Offline
                              ODБOï
                              wrote on 26 Apr 2019, 19:38 last edited by ODБOï
                              #14

                              @Kent-Dorfman hi
                              It looks like the problem is solved... I tried to reproduce the same thing to test the commands you send me, but the application works correctly without memory leak
                              The only thing i'm not sure i did last week, is setting clients PC ip address 'static', with this done, everything seems to work as expected
                              Thank you all for help

                              1 Reply Last reply
                              0

                              10/14

                              26 Apr 2019, 08:28

                              • Login

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