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 with QLocalSocket
QtWS25 Last Chance

Memory leak with QLocalSocket

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.5k Views
  • 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.
  • S Offline
    S Offline
    steini
    wrote on last edited by
    #1

    Hi
    I'm using a Win7 Desktop, VisualStudio2010 and QT 4.7.4
    I am writing a software which send some audio streams to an other application. I use QLocalSocket for the "inter process communication"
    In the first release of my program GUI and the working and sending part was in the same thread. If I sending data the private memory (using process explorer to see properties of the running program) of the program increase proportional to the data which I send and if the stream is empty the memory clears (I don't know why).

    Now I split the Gui from the working and sending part (QLocalSocket instantiate in the new Thread). The memory did not free. But the program works except the memory leak.

    Can someone tell me how the QLocalSocket normally free the memory. I believe that I forgot some things in the new thread and I'm not very familiar with threads in QT.

    Thanks in advance.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      This could have many reasons, for example buffering and memory allocation strategy, of Qt, the system library or the operating system - it needs not to be a memory leak. Make sure you are really suffering from a memory leak using valgrind, Purify, Visual Studio or alike. This also has the advantage, that such tools most probably can tell you where you actually leak memory.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        steini
        wrote on last edited by
        #3

        Hi
        I didn't found a memory leak in my code (maybe I'm wrong). If I remove the write functions to the socket object is there no increasing memory use. That's the reason that I believe the leak is in the socket object.

        If I delete the QLocalSocket object in the thread, the memory is free. Than I instantiate the QLocalSocket again and all runs.

        But I think it's not a good style to delete and instantiate an object again and again.

        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