Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.0, 4.7.0
-
None
-
Windows XP
-
49257f86bdb090d97c387183e8f600bbb8a7eef3
Description
Memory usage increases a lot when QFontMetrics::boundingRect() is used, this changed from Qt 4.5.3 with the change - 04d18b38c38c5ff623b30366ea08d56128b9b7d0. Specifically the following part of the change:
@@ -910,8 +910,9 @@ void QFontDatabase::load(const QFontPrivate *d, int script) // normalize the request to get better caching QFontDef req = d->request; if (req.pixelSize <= 0) - req.pixelSize = qMax(1, qRound(req.pointSize * d->dpi / 72.)); - req.pointSize = 0; + req.pixelSize = qreal((req.pointSize * d->dpi) / 72.); + if (req.pixelSize < 1) + req.pixelSize = 1; if (req.weight == 0) req.weight = QFont::Normal; if (req.stretch == 0)
Changing the req.pixelSize line makes the difference in the case of the example. Attached is an example that reproduces the problem (just use task manager, note that in 4.5.3 it finishes a lot quicker than in 4.6.0 and subsequently uses a lot less memory)