Very high CPU usage (~30% - 50%) on base / empty game on Linux
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
- 領域
- game-dev, performance
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Dart
- スター
- 10.8k
- フォーク
- 1.1k
- 平均マージ
- 1日 16時間
- マージ済み PR(30日)
- 60
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
flame-engine/flame のほかの issue
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
flame-engine/flame#4131 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement v2
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
flame-engine/flame#4116 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
flame-engine/flame#4063 ·
メンテナーはふだん 1 日以内に返信
-
TextComponent shadows are not affected by OpacityEffect対応中かも @spydon が 49 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
flame-engine/flame#4013 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
flame-engine/flame#4012 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
flame-engine/flame の issue をすべて見る
似ている issue
-
@apps/catalog enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ymm-oss/flutter-mobile-project-template#699 ·
メンテナーはふだん 15 日以内に返信
-
area::build area::tests
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
linagora/twake-on-matrix#3504 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
[Packages] [flutter_shaders] InkWell shader golden test fails on Flutter stable and Master channelsオープンfrom: manual-qa
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
espresso3389/pdfrx#777 ·
メンテナーはふだん 4 日以内に返信
-
README highlightsオープンdocumentation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
patarapolw/lingua_srs#22 ·