Qt memory management. What's wrong?

后端 未结 1 1335
忘了有多久
忘了有多久 2021-01-22 09:03

I have a question about memory leaks in Qt.

I have a QMainWindow with 2 QPushButtons.

First button click signal:

m_label = new QLabel(this);

QPi         


        
相关标签:
1条回答
  • 2021-01-22 10:00
    1. After first call of QImage img("1.png") Qt loads image formats plugins, and leaves them loaded after use (for performance issues). So part of memory that's left is from loaded plugins, and it's not a leak.
    2. Where do you allocate those QImages (img...img9 case)? Are you sure that they go out of scope?
    3. Remember that OS doesn't always retain memory immediately after freeing it by your software.
    0 讨论(0)
提交回复
热议问题