Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
5.7.0, 5.8.0
-
None
-
Windows 7 64bit, Precompiled Qt-Packages Qt 5.2.1 MinGW 4.8 , Qt 5.7 MinGW 5.3
-
a843db6e2 (dev), c8fbdb5c3 (6.8), 94a3a492f (dev), 7a67ed770 (6.8)
Description
There is a significant increase of runtime memory consumption of up to 300% more memory when using QIcon in Qt 5.7 compared to Qt 5.2.1.
The documentation says that images for an icon given from a file are loaded on demand, but it seems that this is not the case anymore.
I attaches a zip file with a buildable example that creates a widget containing some comboboxes with the same icons for every item. It has two boolean command line options:
- -i or --icon : use the QIcon constructor
- -p or --pixmap : use the QPixmap constructor
If you set both, the QIcon constructor will be used, if you set none no icons will be loaded.
I measured the memory usage with the windows task manager. The results are the following:
- QIcon Constructor (-i):
- Qt 5.2.1: 5740 KB
- Qt 5.7: 46472 KB
- QPixmap Constructor (-p):
- Qt 5.2.1: 7184 KB
- Qt 5.7: 9712 KB
- No Icons (no options):
- Qt 5.2.1: 4636 KB
- Qt 5.7: 8096 KB
Attachments
For Gerrit Dashboard: QTBUG-59621 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
189213,2 | Cache QIcons created with the constructor that takes a file name | dev | qt/qtbase | Status: ABANDONED | -1 | 0 |
563608,7 | QIcon::addFile() delay-load icons when a proper size is given | dev | qt/qtbase | Status: MERGED | +2 | +1 |
563866,4 | QIcon::addFile() delay-load icons when no size is given | dev | qt/qtbase | Status: MERGED | +2 | 0 |
568181,2 | QIcon::addFile() delay-load icons when no size is given | 6.8 | qt/qtbase | Status: MERGED | +2 | 0 |
569670,2 | QIcon::addFile() delay-load icons when a proper size is given | 6.8 | qt/qtbase | Status: MERGED | +2 | 0 |