Skip to content

[Impeller] VkImageView leak in WrappedTextureSourceVK (embedder delegate path) #181967

Closed

Description

@RickyvdBerg

Description

WrappedTextureSourceVK in shell/gpu/gpu_surface_vulkan_impeller.cc leaks a VkImageView every frame when using the embedder delegate code path.

Steps to reproduce

  1. Create a custom embedder using FlutterVulkanRendererConfig (the Vulkan delegate path)
  2. Run any Flutter app
  3. Each frame, AcquireFrame calls createImageView() and stores the result as a raw vk::ImageView
  4. The destructor ~WrappedTextureSourceVK() {} is empty — the VkImageView is never destroyed

This leaks ~60 VkImageView handles per second. On a long-running app this will eventually exhaust driver resources.

Analysis

The fix is straightforward: use vk::UniqueImageView instead of raw vk::ImageView for RAII ownership. The resource lifetime is safe because Impeller's TrackedObjectsVK holds a shared_ptr<TextureSourceVK> until the GPU fence signals completion, preventing premature destruction.

This only affects the embedder delegate path (delegate_ != nullptr). Android passes nullptr as the delegate and uses AcquireNextSurface() instead, so Android is not affected.

Environment

  • Found on Linux/Wayland with a custom Vulkan embedder
  • NVIDIA GeForce RTX 5070 Ti, driver 570.x
  • Flutter engine at commit f916dd6

Labels

  • e: impeller
  • platform-linux
  • P2

Activity

  1. github-actions commented on Feb 25, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  2. locked as resolved and limited conversation to collaborators on Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions