0

I am working on a Qt Desktop project, each Ui page contains almost 60 widgets inform of labels, textedit, Qpushbutton etc, Stylesheet is being applied to all the widgets like

QString styleSheetLabel = QString("QLabel{font-size: %1pt;}").arg(fontSize); 
ui->label->setStyleSheet(styleSheetLabel);

When I am opening a new page my Memory consumption almost increases by 15 MB, and does not comeback to previous value after closing the page.After looking for the issue found that commenting the code related to stylesheet the consumption was only increasing by 0.5 to 1 MB. How can I fix this issue.

I have already tried following but none worked for me.

https://forum.qt.io/topic/74686/remove-applied-stylesheet-in-qt

https://www.qtcentre.org/threads/38841-How-to-reset-a-stylesheet-to-default

https://forum.qt.io/topic/62197/how-to-stylesheet-delete

TylerH
  • 20,799
  • 66
  • 75
  • 101
Asus gates
  • 380
  • 1
  • 5
  • 20
  • 1
    Please use a proper tool to measure memory consumption like e.g. valgrind or similiar. Just because your OS doesn't free the memory immediately doesn't mean that there is some kind of leak. – chehrlic Jan 24 '21 at 17:54
  • Why exactly do you believe the middle code segment isn't freeing the memory? If it's because some external monitor says the process takes up space but doesn't release it, see https://stackoverflow.com/questions/54628096/c-deleting-object-do-not-free-memory/54628160#54628160 – SajadBlog Jan 25 '21 at 05:25

0 Answers0