delphidelphi-xedelphi-ide

Delphi XE takes one full core (100% CPU utilization)


My Delphi started to overheat the CPU. As soon as I start Delphi, it will take a full core for itself and the coolers start to work really hard. There is any trick to fix this?

I know that some people here on Stack Overflow will start to release hot steam if I use the words 'Delphi' and 'bug' together, but this is a really nasty bug since it will waste lot of energy (especially when on battery) and will make the computer age prematurely due to overheating.


Update:

The problem appears only if the active tab is a project (dproj) file. As soon as I switch to another file (pas) the CPU goes back to 0%-1%. It happens with ANY dproj file but it happens ONLY if IDE is visible on screen (non-minimized to taskbar). So it is obviously a rendering bug.


Update:

Looks like Warren P has found a way to produce a similar bug. See his answer.


Update:

I have seen the issue also appearing with a VERY large PAS unit but the max CPU utilization appears after I let Delphi IDE window in background (unused) for 3-5 minutes. I can solve it by minimizing the window to task bar or by switching to another IDE tab.


Solution

  • I found a way to reproduce a problem very much like your problem. Create a new delphi project and add to the .DPR (main project source) an ifdef condition that contains some code like this that won't parse...

    program IdeTestProject1;
    {$ifdef FOO}
    bar
    {$endif}
    
    uses
      Forms,
      Unit1 in 'Unit1.pas' {Form1},
      Unit2 in 'Unit2.pas' {Form2},
      Unit3 in 'Unit3.pas' {Form3},
      Unit4 in 'Unit4.pas' {Form4},
      Unit5 in 'Unit5.pas' {Form5},
      Unit6 in 'Unit6.pas' {Form6};
    
    {$R *.res}
    
    begin
      Application.Initialize;
      Application.MainFormOnTaskbar := True;
      Application.CreateForm(TForm1, Form1);
      Application.CreateForm(TForm2, Form2);
      Application.CreateForm(TForm3, Form3);
      Application.CreateForm(TForm4, Form4);
      Application.CreateForm(TForm5, Form5);
      Application.CreateForm(TForm6, Form6);
      Application.Run;
    end.
    

    Therefore my suggestion is that you find all conditional compilation directives and other complex syntax, including any functions or code that is directly in the DPR and move it to another unit. Either code completion, error insight, or some other feature is relentlessly reparsing this unit, and this is resulting in a performance bug.