Delphi XE采用一个完整内核(100%CPU使用率) [英] Delphi XE takes one full core (100% CPU utilization)

查看:147
本文介绍了Delphi XE采用一个完整内核(100%CPU使用率)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Delphi开始使CPU过热。一旦我开始使用Delphi,就需要一个完整的内核,并且散热器确实开始工作。有什么技巧可以解决此问题?

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

我知道,如果我同时使用 Delphi和 bug这两个字,Stack Overflow上的某些人将开始释放热气,但这确实很讨厌错误,因为它将浪费大量能量(尤其是使用电池),并且由于过热而使计算机过早老化。

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.

更新:

仅当活动选项卡是项目(dproj)文件时,问题才会出现。一旦我切换到另一个文件(pas),CPU就会回到0%-1%。任何dproj文件都会发生这种情况,但只有在屏幕上显示IDE时才会发生(未最小化到任务栏)。因此,显然这是一个渲染错误。

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.

更新:

看起来像沃伦·P(Warren P)一样,已经找到了产生类似错误的方法。见他的答案。

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

更新:

我见过这个问题也出现在非常大的PAS单元上,但是当我让Delphi IDE窗口在后台(未使用)3-5分钟后,出现了最大CPU利用率。我可以通过最小化任务栏窗口或切换到另一个IDE选项卡来解决它。

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.

推荐答案

我找到了一种重现方法一个非常像您的问题的问题。创建一个新的delphi项目并将一个ifdef条件添加到.DPR(主项目源)中,该条件包含诸如此类的无法解析的代码...

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.

因此,我的建议是找到所有条件编译指令和其他复杂语法,包括任何函数或代码直接在DPR中并将其移动到另一个单元。代码完成,错误洞察力或其他某些功能会不断地重新解析该单元,这会导致性能错误。

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.

这篇关于Delphi XE采用一个完整内核(100%CPU使用率)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆