[Interest] Memory Leak when instantiating QWidget based windows

william.crocker at analog.com william.crocker at analog.com
Thu Sep 8 14:55:36 CEST 2016


On 09/07/2016 04:23 PM, Mike Jackson wrote:
> We are attempting to track down a memory leak that we _think_ we have. We have
> reduced our code to the point where all we do is invoke a new QWidget instance,
> show() it, hide() it and then delete it. We do this in a loop 100 times. We
> monitor the memory use before and after the loop using OS X's Activity monitor.
> At the end of the loop there is more memory being used than before the loop, by
> about 2~3MB worth.
>
> My question is: Is this normal for a Qt Application to retain some memory for
> each QWidget through global variables and such? Is it something in OS X 10.10?
>
> Thanks to anyone who can shed a little light on this for us. Oh. This is with Qt
> 5.6.1-1 on OS X 10.10.5. We also notice this on Windows 10 with the same version
> of Qt.
>

You should add valgrind to your toolbox.
Valgrind can track memory usage and note leaks.

> Thanks
>



More information about the Interest mailing list