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

C++ parser hogs CPU

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • Qt Creator 3.5.1
    • Qt Creator 3.5.0-beta1
    • C/C++/Obj-C++ Support
    • None
    • Kubuntu 15.04, x86_64, XFCE 4.12. Not using clang C++ parser backend.

    Description

      Sometimes when editing or simply navigating C++ code QtCreator starts to consume 100% of one or several CPU cores. In some cases this results in UI being blocked for considerable time (I had cases of several seconds, but more often the UI is not blocked or responsiveness is slightly reduced). I dumped a few backtraces of QtCreator while CPU load is high and it looks like only threads involving C++ parser are active at that time (one or multiple threads). See these backtraces attached.

      I've started noticing this behavior in QtCreator 3.4.2 and didn't notice it in 3.4.1. The problem is also present in 3.5.0 beta1.

      It doesn't seem like the behavior is triggered by a particular code, although it is possible that it depends on the size and complexity of the function being edited and the surrounding code. We're using C++11 with Boost 1.58. You can try typing the following code piece in a CMake C++ project with Boost headers in your include path:

      #include <cstdint>
      #include <cmath>
      #include <limits>
      #include <boost/assert.hpp>
      #include <boost/mpl/assert.hpp>
      #include <boost/fusion/include/at.hpp>
      #include <boost/fusion/include/vector.hpp>
      #include <boost/fusion/include/tuple.hpp>
      #include <boost/fusion/include/zip.hpp>
      #include <boost/fusion/include/accumulate.hpp>
      #include <boost/type_traits/is_same.hpp>
      
      namespace foo {
      
      float bar()
      {
      	struct local
      	{
      		static void local_foo()
      		{
      		}
      	};
      
      	local::local_foo();
      
      	return 0.0;
      }
      
      }
      

      As you type, you will notice high CPU load. You can also try to navigate around this code with mouse by clicking on function/class/namespace names (to move the cursor to the clicked point). You will notice the interface becoming sluggish and high CPU load.

      Attachments

        1. 1.txt
          26 kB
        2. 2.txt
          23 kB
        3. 3.txt
          32 kB
        4. 4.txt
          49 kB

        Activity

          People

            kosjar Nikolai Kosjar
            lastique Andrey Semashev
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: