2

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.

Gabriel
  • 20,797
  • 27
  • 159
  • 293

3 Answers3

7

Try removing any plugins for the Delphi IDE you might have added. Try to see if it only happens on specific projects or source files. Use a debugger to break into the Delphi process and see what the call stack is. That way you might see what part of Delphi is spinning the CPU.

Lars Truijens
  • 42,837
  • 6
  • 126
  • 143
  • 1
    My Delphi was installed (for the first time) two weeks ago. I installed no plugins until I finished porting my code (today). – Gabriel Jun 01 '11 at 08:53
  • 1
    What about third party components Altar? Take them all out, until you find the one that does this. – Warren P Jun 01 '11 at 17:52
  • I do have 3rd party VCLs. I will try to see if this will fix the issue. – Gabriel Jun 01 '11 at 21:30
4

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.

Warren P
  • 65,725
  • 40
  • 181
  • 316
  • So, I am not crazy. It really happens! Thanks Warren. – Gabriel Jun 01 '11 at 21:31
  • So my answer was potentially correct (switch off code insight/error insight), but was deleted... – Andreas Jun 02 '11 at 11:40
  • Yes Andreas. My guess is that error insight is normall triggered on each time that a text buffer's content is changed but that in extreme error cases, a parse is aborted by an uncaught exception, and the "dirty bit" is not cleared, leading to an endless cascade of parsing, and high CPU usage. – Warren P Jun 02 '11 at 18:17
  • Well, my library is in use - therefore it compiles nicely and without warnings and hints. But "I think you are right about problem being caused by code insight/error insight. – Gabriel Jun 08 '11 at 10:48
  • PS: 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. – Gabriel Jun 08 '11 at 10:50
  • 1
    did you try removing IFDEFs and other precompiler directives, from your dpr? – Warren P Jun 08 '11 at 12:57
1

I have with "process monitor" utility and checked the bds.exe operations. I have found that more .dcu are processed. (Open File, read File, close file). To fix I have removed all .dcu

tirez
  • 11
  • 1