Results 1 to 1 of 1

Thread: QLocalServer / QLocalSocket major memory leaks?

  1. #1
    Join Date
    Jul 2009
    Posts
    12
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QLocalServer / QLocalSocket major memory leaks?

    Hello all,

    I'm transferring large amounts of data from client process (with QLocalSocket) to QLocalServer.

    The problem is, I get some major memory leaks (especially under Linux), as if all my messages are stored somewhere. I modified the stock fortune server/client examples to show what I mean.

    Qt 4.6.2 under Linux:
    Client process' memory usage increases with every message it sends, proportional to the sent data amount.
    Server process' memory usage increases with every received message, but maybe about 1/4 of the client's memory usage.

    Qt 4.6.3 under Windows (MSVC):
    Client's process doesn't increase its memory usage, it just fluctuates within reasonable limits.
    Server process' memory usage increases like in Linux.

    I did some checks with valgrind on the client (with --leak-check=full and --show-reachable=yes), it shows:

    ==25589== 429,916,160 bytes in 205 blocks are still reachable in loss record 938 of 938
    ==25589== at 0x4C242DE: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==25589== by 0x5E8C549: QByteArray::realloc(int) (qbytearray.cpp:1424)
    ==25589== by 0x5E8C92D: QByteArray::resize(int) (qbytearray.cpp:1380)
    ==25589== by 0x5B8F53E: QRingBuffer::reserve(int) (qringbuffer_p.h:175)
    ==25589== by 0x5B8A22D: QAbstractSocket::writeData(char const*, long long) (qabstractsocket.cpp:2156)
    ==25589== by 0x5F13800: QIODevice::write(char const*, long long) (qiodevice.cpp:1324)
    ==25589== by 0x4049D2: LocalClient::send(QByteArray const&) (qiodevice.h:127)
    ==25589== by 0x40444A: Client::sendData() (client.cpp:93)
    ==25589== by 0x404CEC: Client::qt_metacall(QMetaObject::Call, int, void**) (moc_client.cpp:72)
    ==25589== by 0x5F95E96: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (qobject.cpp:3293)
    ==25589== by 0x5698141: QAbstractButton::clicked(bool) (moc_qabstractbutton.cpp:206)
    ==25589== by 0x53AC98A: QAbstractButtonPrivate::emitClicked() (qabstractbutton.cpp:546)


    Looks like there is some continuous allocation within QAbstractSocket or QRingBuffer?

    I ran the server through valgrind as well, but there were no leaks of any major size (I guess they are freed automatically).

    So, it seems there are 2 problems here - one is in Linux only (client), the other is in both Linux and Windows (server).

    Can anyone please reproduce this? Do I have some silly bug in my code (attached)?
    Should this be reported to Nokia?

    Thanks a lot in advance!
    Attached Files Attached Files

Similar Threads

  1. Using QLocalServer and QLocalSocket
    By danc81 in forum Qt Programming
    Replies: 0
    Last Post: 10th November 2009, 12:09
  2. IPC with QLocalServer/QLocalSocket
    By ManuMies in forum Qt Programming
    Replies: 1
    Last Post: 11th February 2009, 20:09
  3. Memory Leaks
    By kaushal_gaurav in forum Qt Programming
    Replies: 4
    Last Post: 20th October 2008, 16:26
  4. memory leaks
    By Fastman in forum Qt Programming
    Replies: 1
    Last Post: 5th March 2008, 08:00
  5. why there are memory leaks in Qt?
    By cocalele in forum Qt Programming
    Replies: 1
    Last Post: 19th March 2006, 09:55

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.