Skip to content

Wrap EGL image usage in a GObject#183539

Merged
auto-submit[bot] merged 5 commits intoflutter:masterfrom
robert-ancell:linux-wrap-egl-image
Mar 17, 2026
Merged

Wrap EGL image usage in a GObject#183539
auto-submit[bot] merged 5 commits intoflutter:masterfrom
robert-ancell:linux-wrap-egl-image

Conversation

@robert-ancell
Copy link
Contributor

This ensures it is destroyed when no object is using it. It was previously leaking.

Fixes #182192

This ensures it is destroyed when no object is using it.
It was previously leaking.

Fixes flutter#182192
@robert-ancell robert-ancell requested a review from a team as a code owner March 11, 2026 21:27
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions bot added engine flutter/engine related. See also e: labels. platform-linux Building on or for Linux specifically a: desktop Running on desktop team-linux Owned by the Linux platform team labels Mar 11, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a FlEGLImage GObject to manage the lifecycle of EGLImage handles, fixing a memory leak. The FlFramebuffer struct is updated to use this new GObject instead of a raw EGLImage handle. The related functions are modified to use GObject reference counting (g_object_ref, g_clear_object) for proper ownership and cleanup of the EGL image, especially when it is shared between sibling framebuffers.

@robert-ancell
Copy link
Contributor Author

Updated as Gemini did a better review in #183653 :)

Copy link
Contributor

@mattkae mattkae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, checks out !

@robert-ancell robert-ancell added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Mar 16, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Mar 17, 2026
Merged via the queue into flutter:master with commit a57c730 Mar 17, 2026
188 of 189 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 17, 2026
@robert-ancell robert-ancell deleted the linux-wrap-egl-image branch March 17, 2026 03:18
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 17, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 17, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 17, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 17, 2026
github-merge-queue bot pushed a commit that referenced this pull request Mar 18, 2026
Add reuse render_sibling to avoid memory leak. to @robert-ancell PR
#183539

We observed a memory leak on Linux Desktop with Wayland on embedded ARM
cpu and an OpenGL ES driver.
While the fix works in our environment, I'm not sure it's correct in all
scenarios. Maybe someone with more experience in the Flutter Linux
rendering can review and provide some feedback.
The memory leak seems related to issue mentioned below.  

#182192


## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Robert Ancell <[email protected]>
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Mar 18, 2026
Roll Flutter from 732e05dd483c to d117642c18e0 (47 revisions)

flutter/flutter@732e05d...d117642

2026-03-17 [email protected] Roll Skia from fa3bb1f60d99 to dba893a44d7a (1 revision) (flutter/flutter#183783)
2026-03-17 [email protected] [ios][pv]fix admob banner scrollable on ios 18.2 (flutter/flutter#183274)
2026-03-17 [email protected] Roll Packages from 0f2eeae to a9d36fb (2 revisions) (flutter/flutter#183782)
2026-03-17 [email protected] Update goldctl version (flutter/flutter#183538)
2026-03-17 [email protected] Roll Skia from 69be1087807b to fa3bb1f60d99 (1 revision) (flutter/flutter#183779)
2026-03-17 [email protected] Roll Dart SDK from 38dedf00c2cd to 30cdd2634429 (1 revision) (flutter/flutter#183778)
2026-03-17 [email protected] Roll Fuchsia Linux SDK from s7rq9m8tH2aZtX-kP... to zYBvfzIH95BY3cCzL... (flutter/flutter#183777)
2026-03-17 [email protected] Roll Skia from 4ea039236580 to 69be1087807b (2 revisions) (flutter/flutter#183772)
2026-03-17 [email protected] Roll Skia from fb402093cfb5 to 4ea039236580 (1 revision) (flutter/flutter#183770)
2026-03-17 [email protected] Roll Skia from d6bc6d17d637 to fb402093cfb5 (8 revisions) (flutter/flutter#183765)
2026-03-17 [email protected] Roll Dart SDK from ff50ab8ecea4 to 38dedf00c2cd (2 revisions) (flutter/flutter#183764)
2026-03-17 [email protected] Wrap EGL image usage in a GObject (flutter/flutter#183539)
2026-03-17 [email protected] Adds platform_view_test_macos_impeller (flutter/flutter#183760)
2026-03-17 [email protected] Adds flush to metal screenshotter. (flutter/flutter#183758)
2026-03-16 [email protected] Add a platform OpenGL context. (flutter/flutter#183715)
2026-03-16 [email protected] Fix formatting, capitalization, and grammar in activation issue template (flutter/flutter#183061)
2026-03-16 [email protected] Roll Dart SDK from 4a6febbf882e to ff50ab8ecea4 (2 revisions) (flutter/flutter#183739)
2026-03-16 [email protected] docs: add code review guidance to CONTRIBUTING.md (flutter/flutter#182778)
2026-03-16 [email protected] Filter 'waiting for customer response' issues from macOS triage (flutter/flutter#183552)
2026-03-16 [email protected] Adds github action to reset cicd when new branches come (flutter/flutter#183675)
2026-03-16 [email protected] Adds macos impeller complex layout performance test (flutter/flutter#183669)
2026-03-16 [email protected] Roll Dart SDK from b74e5b537d71 to 4a6febbf882e (2 revisions) (flutter/flutter#183695)
2026-03-16 [email protected] Use properties to configure leak_tracking and test_randomization_off in .ci.yaml (flutter/flutter#183605)
2026-03-16 [email protected] [flutter_tools] Avoid File.exists and File.stat, as per enforced lint rule (flutter/flutter#183463)
2026-03-16 [email protected] Properly parse URIs for testPath when the host is running on Windows. (flutter/flutter#176881)
2026-03-16 [email protected] Roll Packages from 91f7c33 to 0f2eeae (6 revisions) (flutter/flutter#183730)
2026-03-16 [email protected] Roll Skia from a6ccaf95c6e0 to d6bc6d17d637 (5 revisions) (flutter/flutter#183726)
2026-03-16 [email protected] Roll Fuchsia Linux SDK from WOfyEFkxf9JX26VS-... to s7rq9m8tH2aZtX-kP... (flutter/flutter#183723)
2026-03-15 [email protected] Roll Skia from 34ace196b838 to a6ccaf95c6e0 (2 revisions) (flutter/flutter#183712)
2026-03-14 [email protected] Roll Fuchsia Linux SDK from vAWG8mRvsQHblDBsy... to WOfyEFkxf9JX26VS-... (flutter/flutter#183694)
2026-03-14 [email protected] Roll Skia from 06106120c6bf to 34ace196b838 (1 revision) (flutter/flutter#183677)
2026-03-14 [email protected] Roll Dart SDK from 6a3dc9d4f881 to b74e5b537d71 (2 revisions) (flutter/flutter#183676)
2026-03-14 [email protected] Add some quality of life improvements to the release GitHub workflows. (flutter/flutter#183658)
2026-03-14 [email protected] Fix RouteAware.didPushNext documentation inaccuracy (flutter/flutter#183097)
2026-03-13 [email protected] Adds complex layout impeller startup benchmark (flutter/flutter#183655)
2026-03-13 [email protected] Adds switch for sdf rendering plus golden tests (flutter/flutter#183543)
2026-03-13 [email protected] Made complex_layout_scroll_perf explicitly skia (flutter/flutter#183663)
2026-03-13 [email protected] Update android integration test to match the current android semantics (flutter/flutter#183548)
2026-03-13 [email protected] Roll Skia from 6c0346103c24 to 06106120c6bf (3 revisions) (flutter/flutter#183654)
2026-03-13 [email protected] Roll Dart SDK from d5f6d3c17499 to 6a3dc9d4f881 (1 revision) (flutter/flutter#183652)
2026-03-13 [email protected] Fix PinnedHeaderSliver semantics focus capture (flutter/flutter#179023)
2026-03-13 [email protected] [a11y][android] In Android 16, sendWindowContentChangeEvent when check state changes (flutter/flutter#183606)
2026-03-13 [email protected] Update gradle utils to know about kgp 2.3.10 constraints (flutter/flutter#183416)
2026-03-13 [email protected] Roll Skia from 029229d8be91 to 6c0346103c24 (5 revisions) (flutter/flutter#183648)
2026-03-13 [email protected] Roll Fuchsia Linux SDK from jJbpv4J_tjW-wuKDq... to vAWG8mRvsQHblDBsy... (flutter/flutter#183646)
2026-03-13 [email protected] [flutter_tools] Support flavors and transformers for shaders (flutter/flutter#181889)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-linux Building on or for Linux specifically team-linux Owned by the Linux platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Linux] High VRAM usage when resizing desktop app on Wayland

2 participants