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

Text items have a very high per-character memory cost

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 5.4.0 Beta
    • Quick: SceneGraph
    • None
    • Linux 64bits

    Description

      Rendering very large text documents can easily increase the memory usage of applications very high.

      Attached is a Text item in which the QString documentation is loaded.

      Here is an excerpt of ms_print of the massif peak snapshot of the attached trace:

      69 30,628,915,902      500,959,864      499,513,679     1,446,185            0
      99.71% (499,513,679B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
      ->86.84% (435,023,672B) 0x69A3A84: QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlags<QArrayData::AllocationOption>) (qarraydata.cpp:93)
      | ->51.02% (255,613,536B) 0x4FF6B39: QTypedArrayData<QSGGeometry::TexturedPoint2D>::allocate(unsigned long, QFlags<QArrayData::AllocationOption>) (qarraydata.h:216)
      | | ->51.02% (255,613,536B) 0x4FF5890: QVector<QSGGeometry::TexturedPoint2D>::reallocData(int, int, QFlags<QArrayData::AllocationOption>) (qvector.h:499)
      | |   ->51.02% (255,613,536B) 0x4FF4D28: QVector<QSGGeometry::TexturedPoint2D>::reserve(int) (qvector.h:359)
      | |     ->51.02% (255,613,536B) 0x4FF37BF: QSGDistanceFieldGlyphNode::updateGeometry() (qsgdistancefieldglyphnode.cpp:204)
      ...
      

      The plain text document including all markup is 389996 bytes, at 435,023,672B just for distance field nodes, this means that each character takes around 1115 bytes or memory.

      Various tests revealed that the per-character cost is between 500 and 1000 bytes of memory.

      As reference, the render process in Chromium takes 50MB to load the formated QString documentation, including images.

      Attachments

        Issue Links

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

          Activity

            People

              janichol Andy Nichols
              jturcott Jocelyn Turcotte
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes