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

QML TextEdit leaks memory

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 5.12.2
    • None
    • Windows 10
    • iOS/tvOS/watchOS, Windows

    Description

      TextEdit seems to leak memory when text is entered and deleted. This was reproduced on Windows 10 and iOS (iPhone 11 pro, 14.6) with Qt 5.12.2 so far. Perhaps more platforms are affected.

      This becomes very apparent when inputting lots of text, some hundreds of lines or more, and watching the application's memory consumption. A default-created (empty QML) project with the following code quickly gets from ~80mb to >1500mb memory consumption.

      After deleting the text from the TextEdit, the memory consumption goes down but stays at ~800mb (10x the initial amount!). In more complex applications with lots of QML, custom fonts, etc., where the TextEdit is supposed to hold large texts, the problem is amplified by a factor of 2-10, and breaks the user experience (the application slows down until crashing in the worst case).

      My minimal example:

      import QtQuick 2.12
      import QtQuick.Window 2.12
      
      Window {
          width: 1024
          height: 768
          visible: true
          title: qsTr("Hello World")
      
          TextEdit {
              anchors.fill: parent
          }
      }
      

      // EDIT: Probably related to https://bugreports.qt.io/browse/QTBUG-103819.

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              julianw Julian Weiß
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes