ofxImGui icon indicating copy to clipboard operation
ofxImGui copied to clipboard

CPU ressource leak ?

Open martialgallorini opened this issue 9 years ago • 8 comments

Hello,

i have just built a basic UI with some sliders and buttons without binding anything to it.

strange behavior : when the app has the focus, everything seems ok and CPU usage is around 5% on my core i7 quad cores. but as soon as the app is out of focus (i.e. i bring my chrome browser in front) then my ImGui app suddenly eat 97% of CPU, computer gets hot and fan is going mad.

A similar app built with ofxUI and bind to OSC precesses uses around 2,7 % of CPU no matter what

martialgallorini avatar Nov 17 '15 11:11 martialgallorini

Weird - I am assuming on a Mac?

jvcleave avatar Nov 17 '15 23:11 jvcleave

yes on a macbook pro 15" late 2013

i will try under linux

martialgallorini avatar Nov 18 '15 00:11 martialgallorini

less effect under Ubuntu 14.04.3 but still...

also, same problem with the provided example.

martialgallorini avatar Nov 18 '15 15:11 martialgallorini

@martialgallorini I created a test branch for this. The CPU use certainly is reduced when minimized but I am unsure of the implication on any background tasks (i.e. OSC, image processing, etc)

https://github.com/jvcleave/ofxImGui/tree/minimized-cpu-test

jvcleave avatar Dec 15 '15 03:12 jvcleave

hey. I gave it a shot. It is a bit better but issue persists.

As i said, when app is in the front, it uses much less CPU.

ofApp in front and Chrome in the back :

capture d ecran 2015-12-15 a 17 23 05

Chrome in front with ofApp in the back :

capture d ecran 2015-12-15 a 17 24 02

oF v09 on Macbook Pro core i7 under OSX El Capitan

martialgallorini avatar Dec 15 '15 16:12 martialgallorini

The code is only concerned when the app is minimized. GLFW_FOCUSED (as opposed to GLFW_ICONIFIED ) may work better for background

jvcleave avatar Dec 15 '15 16:12 jvcleave

Yes i see. This sure is better. But this doesn't solve the problem...

Do you think this is related to the OS ?

martialgallorini avatar Dec 15 '15 16:12 martialgallorini

It may partially be related to the OS. Also depends if OF has anything to assist with dealing with app focus in place.

Why doesn't it solve the problem?

jvcleave avatar Dec 15 '15 17:12 jvcleave