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

QPlainTextEdit memory leak

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.9.6
    • None
    • Ubuntu 18.04.1_x64 / X11
      G++
      qt-opensource-linux-x64-5.9.6.run
    • Linux/X11

    Description

      I wrote a simple app with Qt 5.9.6, I ran that and wondered the used memory is growing. After tracing/debugging my application, I realized something about QPlainTextEdit !!!

      The memory leak was for a qplaintextedit as a scratchpad in my app, but after every use of that, I used the clear() function to blank it for next use.

      But the used memory by that scratchpad woudn't be released!

      I decided to test it

      I opened a new project, containing a QPlainTextEdit & a QPushButton(to call clear() function).

      • After run, the used memory was 9.7MiB
      • Entered some long text to QPlainTextEdit, the used memory was 52MiB
      • Pressed the QPushButton(clear() the QPlainTextEdit), the expected used memory is 9.7MiB, but it was 52MiB.

      I tried delete, static allocation, dynamic allocation..., many ways to manage that, but no different!

      What's wrong with QPlainTextEdit ?

      Attachments

        1. heaptrack_with_clear_edited.png
          heaptrack_with_clear_edited.png
          113 kB
        2. heaptrack_with_clear.png
          heaptrack_with_clear.png
          106 kB
        3. heaptrack_without_clear.png
          heaptrack_without_clear.png
          154 kB
        4. memtrace.png
          memtrace.png
          186 kB
        5. qplaintextedit.tar.xz
          1 kB
        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
            mohammads Mohammad Moradi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes