Qt Application Slowing Down
-
@swansorter If you can create one dialog you can create 2 or 3 or 4 or ...
So, what exactly is the problem?@jsulm 1. we have different screens like home screen ,setting screen ,main sort screen , resort1 ,resort2 and resort 3 screens
2.On "home screen" we have setting button.
3.we move to the "setting screen" with code like the following:-settingDialog *sd=new settingDialog(this); sd->setModal(true); close(); //closes the home window sd->setAttribute( Qt::WA_DeleteOnClose); sd->exec();//shows the setting screen
4.On "Setting screen" we have main sort screen Button ,resort1 ,2 ,3 screen buttons to move respective screens.
5.we move to the "main sort screen" with code like the following:-
mainSortDialog *ms=new mainSortDialog();
ms->setModal(true);
ms->setAttribute ( Qt::WA_DeleteOnClose, true );
this->close();//closes the setting screen
ms->exec();//shows the main sort window6.on "main sort screen" we have Back button to go back to "setting screen".
-
we move to the "main sort screen" with code like the following:-
sd=new settingDialog();
sd->setAttribute ( Qt::WA_DeleteOnClose, true );
sd->setModal(true);
this->close();//closes the main sort screen
sd->exec();//shows the setting screen
8.if i do the step 5 and 7 continuously the application gets slower .
-
-
@jsulm 1. we have different screens like home screen ,setting screen ,main sort screen , resort1 ,resort2 and resort 3 screens
2.On "home screen" we have setting button.
3.we move to the "setting screen" with code like the following:-settingDialog *sd=new settingDialog(this); sd->setModal(true); close(); //closes the home window sd->setAttribute( Qt::WA_DeleteOnClose); sd->exec();//shows the setting screen
4.On "Setting screen" we have main sort screen Button ,resort1 ,2 ,3 screen buttons to move respective screens.
5.we move to the "main sort screen" with code like the following:-
mainSortDialog *ms=new mainSortDialog();
ms->setModal(true);
ms->setAttribute ( Qt::WA_DeleteOnClose, true );
this->close();//closes the setting screen
ms->exec();//shows the main sort window6.on "main sort screen" we have Back button to go back to "setting screen".
-
we move to the "main sort screen" with code like the following:-
sd=new settingDialog();
sd->setAttribute ( Qt::WA_DeleteOnClose, true );
sd->setModal(true);
this->close();//closes the main sort screen
sd->exec();//shows the setting screen
8.if i do the step 5 and 7 continuously the application gets slower .
@swansorter said in Qt Application Slowing Down:
if i do the step 5 and 7 continuously the application gets slower
Then you have to investigate.
Did you check CPU usage of your app?
Did you check RAM usage of your app? -
-
Hi
Also did you CHECK that your dialogs are in fact - deleted?
By breakpoints in their destructors.
WA_DeleteOnClose should take care of that but its good to check. -
Hi
Also did you CHECK that your dialogs are in fact - deleted?
By breakpoints in their destructors.
WA_DeleteOnClose should take care of that but its good to check.@mrjj yea checked.....execution of destructors are happening only when i moved to main window
-
@mrjj yea checked.....execution of destructors are happening only when i moved to main window
Well is that the issue then?
If you dont move to mainwin, they are not freed,
so if u never do that then it grows.
or ? -
Well is that the issue then?
If you dont move to mainwin, they are not freed,
so if u never do that then it grows.
or ?@mrjj yes that is the issu..
how to free the object when the perticular screen "dialog" close? -
@mrjj yes that is the issu..
how to free the object when the perticular screen "dialog" close?@swansorter
well first of all you can clean up the places where newing is not needed.
All places where you use exec() for dialogs could just bevoid class::insomefunc() { mainSortDialog ms; this->close();//closes the setting screen ms->exec(); }
and it would be cleaned up as soon as dialog is closed.
So unless you are not using exec() there should be no reason to new it.
and hence that could auto clean lots for you. -
@swansorter
well first of all you can clean up the places where newing is not needed.
All places where you use exec() for dialogs could just bevoid class::insomefunc() { mainSortDialog ms; this->close();//closes the setting screen ms->exec(); }
and it would be cleaned up as soon as dialog is closed.
So unless you are not using exec() there should be no reason to new it.
and hence that could auto clean lots for you.@mrjj i tried this one ... working for me
thank you -
@mrjj i tried this one ... working for me
thank you@swansorter
Good. hopefully it can also cure the leaking. -
@swansorter
Good. hopefully it can also cure the leaking.@mrjj i used breakpoints on distructor
if i use close()...they are not freed
only if remove close()....they get cleared -
@mrjj i used breakpoints on distructor
if i use close()...they are not freed
only if remove close()....they get clearedIm not sure in what context.
if using something like
void class::insomefunc() {
mainSortDialog ms;
this->close();//closes the setting screen
ms->exec();
}MS should always be deleted. the this->close() should have no effect.
If you use new for other classes make sure it still has WA_DeleteOnClose.
-
Im not sure in what context.
if using something like
void class::insomefunc() {
mainSortDialog ms;
this->close();//closes the setting screen
ms->exec();
}MS should always be deleted. the this->close() should have no effect.
If you use new for other classes make sure it still has WA_DeleteOnClose.
@mrjj
am using this one move to main sort
void class::insomefunc() {
mainSortDialog ms;
ms->exec();
}
and back to main screen by using just "hide();" in back button
this is work for me even the memory leakage.
but if use close(); its not working
void class::insomefunc() {
mainSortDialog ms;
this->close();//closes the setting screen
ms->exec();
} -
hi
in what way "not working" ? -
@mrjj
1.i used breakpoints on distructor of each screen.
2.am moving to main sort using
void class::insomefunc() {
mainSortDialog ms;
this->close();//closes the setting screen
ms->exec();
}
3.and moving back to the home page
void class::insomefunc() {
homeDialog h;
this->close();//closes the setting screen
h->exec();
}
at this point it is not moving to destructor
only if i move to mainwindow it moving to destructor mainsort page -
@mrjj
1.i used breakpoints on distructor of each screen.
2.am moving to main sort using
void class::insomefunc() {
mainSortDialog ms;
this->close();//closes the setting screen
ms->exec();
}
3.and moving back to the home page
void class::insomefunc() {
homeDialog h;
this->close();//closes the setting screen
h->exec();
}
at this point it is not moving to destructor
only if i move to mainwindow it moving to destructor mainsort page@swansorter
Hi
Really?
but they are local variables. they will be destroyed.
I can't see anyway, they could avoid that. -
@swansorter
Hi
Really?
but they are local variables. they will be destroyed.
I can't see anyway, they could avoid that.@mrjj said in Qt Application Slowing Down:
will be destroyed
Yes, but only when exec() finishes I guess :-)
-
@mrjj said in Qt Application Slowing Down:
will be destroyed
Yes, but only when exec() finishes I guess :-)