Skip to content

instantiateImageCodecWithSize leaks buffer on web #150016

@curt-weber

Description

@curt-weber

Steps to reproduce

The documentation for this method states:
The buffer will be disposed by this method once the codec has been created, so the caller must relinquish ownership of the buffer when they call this method.

While this is true on non-web platforms as shown below:
dart:ui

On web, you can see that only the codec is disposed but not the buffer, and the buffer isn't cleared in any of the called functions since it passes the underlying .list and not the buffer itself:
web:ui

This is different from my previously filed issue since that describes a leaking image, not a leaking buffer.

Expected results

All platforms should dispose the provided buffer.

Actual results

The web platform doesn't dispose the buffer, so to prevent a double disposal, one must special case the disposal for web so it is properly cleaned up on web/non-web platforms.

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.22.1, on Microsoft Windows [Version 10.0.19044.4291], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.3.5)
[!] Android Studio (version 2021.3)
    X Unable to determine bundled Java version.
[√] Android Studio (version 2023.3)
[√] VS Code (version 1.89.1)
[√] Connected device (3 available)
[√] Network resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work liste: web_canvaskitCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Webe: web_skwasmSkwasm rendering backend for webengineflutter/engine repository. See also e: labels.found in release: 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23platform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions