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

UI freeze right after finishing configuring a project

    XMLWordPrintable

Details

    • Linux/X11, macOS, Windows

    Description

      I have qtbase cmake project opened and successfully configured in Creator. Once i modify a cmake file (add a new line) and save, Creator starts reconfiguring, which is fine.
      Just as the configuration progress bar finishes, Creator freezes the UI (and I get a beach ball) for around 6-10 seconds.

      Using Instruments, I found out that there are many allocations happening during that freeze, and multiple threads (including the main one) are waiting on malloc mutex locks.

      Specifically QHash::detach is called hundreds of thousands of times here
      https://github.com/qt-creator/qt-creator/blob/master/src/plugins/cpptools/builtinindexingsupport.cpp#L193

      0 libsystem_malloc.dylib malloc_zone_malloc
         1 libsystem_malloc.dylib malloc
         2 QtCore QHashData::detach_helper(void (*)(QHashData::Node*, void*), void (*)(QHashData::Node*), int, int)
         3 libCPlusPlus.4.15.1.dylib QHash<Utils::FilePath, QSharedPointer<CPlusPlus::Document> >::detach_helper() /Volumes/T3/Dev/qt/official_qt/5.15.4/clang_64/lib/QtCore.framework/Headers/qhash.h:631
         4 libCPlusPlus.4.15.1.dylib QHash<Utils::FilePath, QSharedPointer<CPlusPlus::Document> >::detach() /Volumes/T3/Dev/qt/official_qt/5.15.4/clang_64/lib/QtCore.framework/Headers/qhash.h:291
         5 libCPlusPlus.4.15.1.dylib QHash<Utils::FilePath, QSharedPointer<CPlusPlus::Document> >::remove(Utils::FilePath const&) /Volumes/T3/Dev/qt/official_qt/5.15.4/clang_64/lib/QtCore.framework/Headers/qhash.h:815
         6 libCppTools.dylib CPlusPlus::Snapshot::remove(QString const&) /Volumes/T3/Dev/qtcreator/qtcreatordev/src/libs/cplusplus/CppDocument.h:409
         7 libCppTools.dylib (anonymous namespace)::index(QFutureInterface<void>&, (anonymous namespace)::ParseParams) /Volumes/T3/Dev/qtcreator/qtcreatordev/src/plugins/cpptools/builtinindexingsupport.cpp:193
         8 libCppTools.dylib (anonymous namespace)::parse(QFutureInterface<void>&, (anonymous namespace)::ParseParams) /Volumes/T3/Dev/qtcreator/qtcreatordev/src/plugins/cpptools/builtinindexingsupport.cpp:255
         9 libCppTools.dylib void Utils::Internal::runAsyncQFutureInterfaceDispatch<void, void (*)(QFutureInterface<void>&, (anonymous namespace)::ParseParams), (anonymous namespace)::ParseParams>(std::__1::integral_constant<bool, true>, QFutureInterface<void>, void (*&&)(QFutureInterface<void>&, (anonymous namespace)::ParseParams), (anonymous namespace)::ParseParams&&) /Volumes/T3/Dev/qtcreator/qtcreatordev/src/libs/utils/runextensions.h:257
        10 libCppTools.dylib void Utils::Internal::runAsyncMemberDispatch<void, void (*)(QFutureInterface<void>&, (anonymous namespace)::ParseParams), (anonymous namespace)::ParseParams, void>(QFutureInterface<void>, void (*&&)(QFutureInterface<void>&, (anonymous namespace)::ParseParams), (anonymous namespace)::ParseParams&&) /Volumes/T3/Dev/qtcreator/qtcreatordev/src/libs/utils/runextensions.h:274
        11 libCppTools.dylib void Utils::Internal::runAsyncImpl<void, void (*)(QFutureInterface<void>&, (anonymous namespace)::ParseParams), (anonymous namespace)::ParseParams>(QFutureInterface<void>, void (*&&)(QFutureInterface<void>&, (anonymous namespace)::ParseParams), (anonymous namespace)::ParseParams&&) /Volumes/T3/Dev/qtcreator/qtcreatordev/src/libs/utils/runextensions.h:303
        12 libCppTools.dylib void Utils::Internal::AsyncJob<void, void (&)(QFutureInterface<void>&, (anonymous namespace)::ParseParams), (anonymous namespace)::ParseParams&>::runHelper<0ul, 1ul>(std::__1::integer_sequence<unsigned long, 0ul, 1ul>) /Volumes/T3/Dev/qtcreator/qtcreatordev/src/libs/utils/runextensions.h:372
        13 libCppTools.dylib Utils::Internal::AsyncJob<void, void (&)(QFutureInterface<void>&, (anonymous namespace)::ParseParams), (anonymous namespace)::ParseParams&>::run() /Volumes/T3/Dev/qtcreator/qtcreatordev/src/libs/utils/runextensions.h:352
        14 QtCore QThreadPoolThread::run()
        15 QtCore QThreadPrivate::start(void*)
        16 libsystem_pthread.dylib _pthread_start
        17 libsystem_pthread.dylib thread_start
      

      Not sure why removing a file from cache needs to detach the whole QHash.

      sha1 of Creator used 97b6b2c0914f9c56da9d80d876abe00bcae1e625

      It already has https://codereview.qt-project.org/c/qt-creator/qt-creator/+/347631 included

      Attachments

        Activity

          People

            con Eike Ziller
            alexandru.croitor Alexandru Croitor
            Votes:
            3 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: