Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Debugging memory leak that happens on MacOS only



  • Hello,

    Some time ago I launched an open source called GrumpyChat, which is an IRC client. Source code can be found here: https://github.com/grumpy-irc/grumpy

    The problem I have is that while everything is running great and smooth on all platforms where I actively use it (Windows, Linux and Mac) there seems to be a memory leak, possibly somewhere within Qt itself, or caused by me using some Qt components in a wrong way, but visible only on MacOS.

    I keep using this app on Linux for months without restart and memory usage never exceeds 200MB, same with Windows. But on MacOS after several days of usage of app without restart its memory usage exceeds even 1GB at which point I always restart it and get back to between 100 - 200.

    There is no valgrind support for MacOS, so I even tried to implement my own primitive memory profiler that simply counts number of existing instances of various classes (increment in ctor, decrement in dtor), which on all platforms show that there is no memory leak - all my own classes get deleted as supposed so none of them causes this. But still on MacOS memory keeps on getting allocated and I have no idea why.

    Is there any way to debug this? I am currently working on Qt 5.12.0 but this problem exists for pretty much all Qt 5 versions.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You can use Xcode tools to analyse your application.


Log in to reply