Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Memory leak
Qt 6.12 LTS is out! See what's new in the release blog

Memory leak

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 5 Posters 2.9k 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.
  • aha_1980A aha_1980

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

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

    ODБOïO Offline
    ODБOïO Offline
    ODБOï
    wrote on 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
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on 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?

      The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

      1 Reply Last reply
      1
      • ODБOïO Offline
        ODБOïO Offline
        ODБOï
        wrote on 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 ..

        JonBJ 1 Reply Last reply
        0
        • ODБOïO ODБOï

          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 ..

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on 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
          • ODБOïO Offline
            ODБOïO Offline
            ODБOï
            wrote on 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

            VRoninV 1 Reply Last reply
            0
            • ODБOïO ODБOï

              @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

              VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on 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
              • ODБOïO Offline
                ODБOïO Offline
                ODБOï
                wrote on 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
                • Kent-DorfmanK Offline
                  Kent-DorfmanK Offline
                  Kent-Dorfman
                  wrote on 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.

                  The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

                  Kent-DorfmanK 1 Reply Last reply
                  1
                  • Kent-DorfmanK Kent-Dorfman

                    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.

                    Kent-DorfmanK Offline
                    Kent-DorfmanK Offline
                    Kent-Dorfman
                    wrote on 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.

                    The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

                    ODБOïO 1 Reply Last reply
                    4
                    • Kent-DorfmanK Kent-Dorfman

                      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.

                      ODБOïO Offline
                      ODБOïO Offline
                      ODБOï
                      wrote on 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

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt
                      • Unsolved