In the window task manager, why can QT program see the memory consumption increase when opening a new widget, but after the widget is closed and the pointer is deleted, the memory consumption does not decrease



  • In the window task manager, why can QT program see the memory consumption increase when opening a new widget, but after the widget is closed and the pointer is deleted, the memory consumption does not decrease


  • Qt Champions 2018

    @canid please show your code.

    And please, aim for shorter topic summaries. the full description can be done in the topic text.

    Regards


  • Qt Champions 2018

    The task manager is no tool to look for memory leaks since it does not show when memory is freed up but only when the OS gives memory back. Use a proper tool for this.



  • @canid
    Apart from @Christian-Ehrlicher's observation about tool for detecting memory consumption.
    I was looking at this recently. What exactly do you mean by "the pointer is deleted"? If you use the usual deleteLater(), memory does not freed until execution returns to the top-level Qt event loop, not before. Or, are you using delete? Even then I wouldn't rely on it being returned to the OS for a one-off. Have you tested this against creating hundreds/thousands of instances of the widget?


Log in to reply