Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MDI application consumes 100% cpu in idle

I'm working on MDI application written in C++ Builder 2010. When child window is in maximized state, application consumes 100% of CPU time in idle mode.

I have used 'Very Sleepy' profiler and it shows that function Sd_childFinalize is using 99% of CPU resources but I can't find it in my code. sd_Child.cpp is the C++ unit where MDI child form class is defined. I only found @@Sd_child@Finalize symbol in executable file. Please help me to understand how to debug this issue.

like image 221
Yury Rudakou Avatar asked Sep 25 '12 17:09

Yury Rudakou


1 Answers

This appears to be a known issue related to actions and the way they are updated in the application idle handler. The following QC report describes your scenario: http://qc.embarcadero.com/wc/qcmain.aspx?d=12706

The solution to your problem, according to the QC report, is to set the TApplication.ActionUpdateDelay property to a value greater than 0.

What I would love to know is why the presence of a maximized client form leads to the VCL's DoActionIdle being called in a busy loop. Presumably execution of an actions's OnUpdate handler leads to another queued message, and another idle cycles, and so on. I'd have thought dealing with that would be the best way to tackle this issue, but perhaps it's hard to achieve.

like image 83
David Heffernan Avatar answered Sep 29 '22 19:09

David Heffernan