Very high CPU usage (~30% - 50%) on base / empty game on Linux
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Active
- Domain
- game-dev, performance
Research direction
Reproduce using the provided pubspec.yaml and lib/main.dart with FlameGame, then build via flutter build linux and watch CPU with htop. First read the bare Flame game tutorial linked and profile the idle game loop. Done means the empty game sits at ~1% CPU like a default Flutter app.
Written by the indexing model from the issue text.
Description
What happened?
Using the recommended starting project, I see that htop shows the running application using 30% to 50% CPU. There are some bwrap child processes that quit after about 20 seconds, but the high CPU usage continues. I took a look at the CPU profiler in my browser, when running the application under profile mode, and there is no record of high CPU usage there.
If I run the default Flutter app in the same way, I get about 1% CPU usage or less while it's running.
I've seen this on Flame 1.38.2, 2.0.0-dev.1 and an older version like 1.31.0.
What do you expect?
I expected CPU usage by Flame to be around 1% or less when not drawing anything to the screen.
How can we reproduce this?
Follow the instructions for a new project, then run it like so:
flutter build linux && build/linux/x64/release/bundle/flame_tmp
Check your CPU profiler for the flame_tmp process.
What steps should take to fix this?
No response
Do have an example of where the bug occurs?
pubspec.yaml:
name: flame_tmp
description: "A test case for Flame"
publish_to: 'none'
version: 0.0.0+1
environment:
sdk: ^3.13.5
flutter: ^3.47.7
dependencies:
flutter:
sdk: flutter
flame: ^1.38.2
#flame_svg: ^2.0.0
lib/main.dart:
import 'package:flame/game.dart';
import 'package:flutter/widgets.dart';
void main() {
final game = FlameGame();
runApp(GameWidget(game: game));
}
Relevant log output
stdout / stderr:
[IMPORTANT:flutter/shell/platform/embedder/embedder_surface_gl_impeller.cc(126)] Using the Impeller rendering backend (OpenGLESSDF).
Gdk-Message: 22:56:58.439: Unable to load from the cursor theme
These seem to be the processes that appear as children for a while:
andrew 14591 0.0 0.0 3876 2436 pts/0 S+ 22:59 0:00 bwrap --unshare-all --die-with-parent --chdir / --ro-bind /usr /usr --dev /dev --ro-bind-try /etc/ld.so.cache /etc/ld.so.cache --ro-bind-try /nix/store /nix/store --tmpfs /tmp-home --tmpfs /tmp-run --clearenv --setenv HOME /tmp-home --setenv XDG_RUNTIME_DIR /tmp-run --setenv RUST_BACKTRACE full --setenv XDG_RUNTIME_DIR /run/user/1000 --symlink /usr/lib /lib --symlink /usr/lib64 /lib64 --ro-bind-try /etc/fonts/conf.d /etc/fonts/conf.d --ro-bind-try /etc/fonts/fonts.conf /etc/fonts/fonts.conf --ro-bind-try /home/andrew/.cache/fontconfig /home/andrew/.cache/fontconfig --ro-bind-try /home/andrew/.config/fontconfig/fonts.conf /home/andrew/.config/fontconfig/fonts.conf --ro-bind-try /home/andrew/.fonts /home/andrew/.fonts --ro-bind-try /var/cache/fontconfig /var/cache/fontconfig --bind-try /home/andrew/.cache/glycin/usr/libexec/glycin-loaders/2+/glycin-svg /home/andrew/.cache/glycin/usr/libexec/glycin-loaders/2+/glycin-svg --setenv XDG_CACHE_HOME /home/andrew/.cache/glycin/usr/libexec/glycin-loaders/2+/glycin-svg --seccomp 24 /usr/libexec/glycin-loaders/2+/glycin-svg --dbus-fd 23
andrew 14592 0.0 0.0 3876 1408 pts/0 S+ 22:59 0:00 bwrap --unshare-all --die-with-parent --chdir / --ro-bind /usr /usr --dev /dev --ro-bind-try /etc/ld.so.cache /etc/ld.so.cache --ro-bind-try /nix/store /nix/store --tmpfs /tmp-home --tmpfs /tmp-run --clearenv --setenv HOME /tmp-home --setenv XDG_RUNTIME_DIR /tmp-run --setenv RUST_BACKTRACE full --setenv XDG_RUNTIME_DIR /run/user/1000 --symlink /usr/lib /lib --symlink /usr/lib64 /lib64 --ro-bind-try /etc/fonts/conf.d /etc/fonts/conf.d --ro-bind-try /etc/fonts/fonts.conf /etc/fonts/fonts.conf --ro-bind-try /home/andrew/.cache/fontconfig /home/andrew/.cache/fontconfig --ro-bind-try /home/andrew/.config/fontconfig/fonts.conf /home/andrew/.config/fontconfig/fonts.conf --ro-bind-try /home/andrew/.fonts /home/andrew/.fonts --ro-bind-try /var/cache/fontconfig /var/cache/fontconfig --bind-try /home/andrew/.cache/glycin/usr/libexec/glycin-loaders/2+/glycin-svg /home/andrew/.cache/glycin/usr/libexec/glycin-loaders/2+/glycin-svg --setenv XDG_CACHE_HOME /home/andrew/.cache/glycin/usr/libexec/glycin-loaders/2+/glycin-svg --seccomp 24 /usr/libexec/glycin-loaders/2+/glycin-svg --dbus-fd 23
Execute in a terminal and put output into the code block below
Output of: flutter doctor -v
[✓] Flutter (Channel stable, 3.47.8, on openSUSE Tumbleweed 7.3.0-1-default, locale en_US.UTF-8) [64ms]
• Flutter version 3.47.8 on channel stable at /home/andrew/.local/lib/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 737ba8f885 (2 days ago), 2026-10-22 21:37:31 -0700
• Engine revision cf636b1dfb
• Dart version 3.13.7
• DevTools version 2.60.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use,
enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
[✓] Android toolchain - develop for Android devices (Android SDK version 37.0.0) [483ms]
• Android SDK at /home/andrew/Android/Sdk
• Emulator version 37.2.12.0 (build_id 16428233) (CL:N/A)
• Platform android-37.2, build-tools 37.0.0
• ANDROID_SDK_ROOT = /home/andrew/Android/Sdk
• Java binary at: /home/andrew/.local/lib/android-studio/jbr/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 21.0.8+-14018985-b1038.68)
• All Android licenses accepted.
[✓] Chrome - develop for the web [17ms]
• CHROME_EXECUTABLE = chromium
[✓] Linux toolchain - develop for Linux desktop [481ms]
• clang version 23.1.3
• cmake version 4.4.4
• ninja version 1.13.2
• pkg-config version 2.5.1
• OpenGL core renderer: AMD Radeon 840M Graphics (radeonsi, krackan1, ACO, DRM 3.64, 7.3.0-1-default)
• OpenGL core version: 4.6 (Core Profile) Mesa 26.2.5
• OpenGL core shading language version: 4.60
• OpenGL ES renderer: AMD Radeon 840M Graphics (radeonsi, krackan1, ACO, DRM 3.64, 7.3.0-1-default)
• OpenGL ES version: OpenGL ES 3.2 Mesa 26.2.5
• OpenGL ES shading language version: OpenGL ES GLSL ES 3.20
• GL_EXT_framebuffer_blit: yes
• GL_EXT_texture_format_BGRA8888: yes
[✓] Connected device (2 available) [806ms]
• Linux (desktop) • linux • linux-x64 • openSUSE Tumbleweed 7.3.0-1-default
• Chrome (web) • chrome • web-javascript • Ungoogled Chromium 156.0.8078.47
[✓] Network resources [238ms]
• All expected network resources are available.
• No issues found!
Affected platforms
Linux, Web
Other information
I'm using OpenSUSE Tumbleweed, a rolling release distribution. My laptop is fairly recent, so it's not underpowered.
Are you interested in working on a PR for this?
- I want to work on this
- Dominant language
- Dart
- Stars
- 10.8k
- Forks
- 1.1k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 61
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from flame-engine/flame
-
Timer with tickCount stays finished after start() or reset()Possibly taken @matthewalberto claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
flame-engine/flame#4240 · 1 comment ·
Maintainers usually reply within 1 day
-
`CameraComponent.follow` follows the local position of a nested targetPossibly taken @ufrshubham claimed this 1 day ago. Openbug
flame-engine/flame#4238 · 1 assignee ·
Maintainers usually reply within 1 day
-
`ComponentPool` returns components to the pool while they are still in use, and loses components removed before mountingPossibly taken @ufrshubham claimed this 18 days ago. Openbug
flame-engine/flame#4191 · 1 assignee ·
Maintainers usually reply within 1 day
-
Move the flame_studio debugging features to flame_devtoolsPossibly taken A pull request linked to this issue is open or already merged. Openenhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
flame-engine/flame#4176 ·
Maintainers usually reply within 1 day
-
discussion enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
flame-engine/flame#4175 ·
Maintainers usually reply within 1 day
All issues in flame-engine/flame
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
spotiflacapp/SpotiFLAC-Mobile#935 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
chriskelly/wish-together#193 ·
Maintainers usually reply within 1 day
-
area: player feature request
Difficulty 2/5 1-3 hours Newbie friendliness 65/100