Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-26326

Potential leak of many QmakeEvalResult instances on session switch

    XMLWordPrintable

    Details

    • Commits:
      c3cee4041190ddd90c35517e21cddcc53a3b863a (qt-creator/qt-creator/6.0)

      Description

      To reproduce:

      1. Apply the following patch:

      diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
      index 6cc4634375..94b59926a0 100644
      --- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
      +++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
      @@ -114,10 +114,13 @@ public:
           }
       };
       
      +static std::atomic_int s_counter = 0;
      +
       class QmakeEvalResult
       {
       public:
      -    ~QmakeEvalResult() { qDeleteAll(directChildren); }
      +    QmakeEvalResult()  { qDebug() << "QmakeEvalResult c'tor" << s_counter.fetch_add(1) + 1; }
      +    ~QmakeEvalResult() { qDebug() << "QmakeEvalResult d'tor" << s_counter.fetch_sub(1) - 1; qDeleteAll(directChildren); }
       
           enum EvalResultState { EvalAbort, EvalFail, EvalPartial, EvalOk };
           EvalResultState state;
      

      2. Load a large qmake based project (I've used qtbase of 5.15).
      3. When project is being loaded quickly switch the session.
      4. From now QmakeEvalResult instances are being constructed and never destroyed. About 400 instances are leaked.

        Attachments

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

          Activity

            People

            Assignee:
            kandeler Christian Kandeler
            Reporter:
            jkobus Jarek Kobus
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes