I am building an application, which will be creating/deleting QMainWindow(along with a lot of QWidgets), on user input. One thing, which surprised me, is that the CPU usage keeps on increasing while the operation is going on.And It never comes down to a lower value, even after the operation has been stopped..
All the other GUI related things dont present a problem.Aforesaid thing happens only when I am creating/deleting QWidgets.
while creating
QWidgets *widget = new QWidget(parent);
& to delete it
widget->hide();
delete widget;
e.g. I am creating them using new
and deleting those widgets using delete
.In fact memory usage is also increasing.I suspect that the widgets are not being deleted; they are getting attached to root window. That is why CPU utilization is increasing.
What is the problem in this regard