Skip to content

[core] High CPU usage #217

@gen2brain

Description

@gen2brain

Hello,

basic_window example is taking a 100% of CPU, one whole core is occupied. I tried to use SetConfigFlags(FLAG_VSYNC_HINT) but it doesn't help. This is on Linux with Intel graphic card. Vsync is enabled, I can confirm that with glxgears util.

Now, I noticed that when I have both SetTargetFPS(60) and SetConfigFlags(FLAG_VSYNC_HINT) or just SetTargetFPS(60) CPU usage is 100%. If I disable SetTargetFPS() and enable just SetConfigFlags(FLAG_VSYNC_HINT) then CPU usage drops to 10% and everything works smooth, and all without the sound of CPU cooler :)

Maybe that can help in fixing this issue.

Also, I changed this line in core.c:
while (windowMinimized) glfwPollEvents()
to
while (windowMinimized) glfwWaitEvents()
so when window is minimized CPU usage drops to 0. Is there any reason to poll for events while window is minimized?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions