Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-15688

[REG]: Memory usage increases a lot when QFontMetrics::boundingRect() is used

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.4
    • 4.6.0, 4.7.0
    • GUI: Font handling
    • 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)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jbornema Joerg Bornemann
            anshaw Andy Shaw (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes