Skip to content

Conversation

@polina-c
Copy link
Contributor

@polina-c polina-c commented Jan 11, 2024

Contributes to #141388

@github-actions github-actions bot added the framework flutter/packages/flutter repository. See also f: labels. label Jan 11, 2024
@polina-c polina-c added the a: leak tracking Issues and PRs related to memory leaks detected by leak_tracker label Jan 12, 2024
@polina-c polina-c marked this pull request as ready for review January 12, 2024 18:50
@polina-c polina-c requested a review from goderbauer January 12, 2024 18:51
/// This is used to:
/// * avoid disposing the [image] when it is owned by other object (when false)
/// * transfer the [image] ownership to this object (when true)
final bool shouldDisposeImage;
Copy link
Member

Choose a reason for hiding this comment

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

This sounds very dubious to me. Why do we have a disposable that is sometimes configured to not be disposed? This sounds like a foot gun. Also, the docs don't really help much in understanding when you should set this to true or false.

/cc @dnfield who maybe has more context on this from back when he added disposal support to images.

Copy link
Contributor Author

@polina-c polina-c Jan 12, 2024

Choose a reason for hiding this comment

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

De-facto rule for disposing is: an object should dispose a member if the object created the member.

It is different for ImageInfo.image:

  1. Sometimes image is cloned
  2. Sometimes image is passed from other object
  3. Historically image was always disposed by ImageInfo, independently on creation story. It can be that some owners of ImageInfo purposely do not dispose ImageInfo because the image inside it is owned by other object.

There is a mess in tests around disposing for images. They are cached and reused. So, there is no way to see if a leak is test-only or real.
In order to clean it up, I need some consistent meaningful story about how it should be.

By this change I want the disposal contract, that is already unusual here, to be explicit and more flexible.

I want to make it possible for ImageInfo creator to decide who will now be responsible for disposal of the image, i.e. if creator wants to transfer the image ownership to ImageInfo or not.

Does it help?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that ImageInfo has some difficult to reason about behavior.

Rather than encoding that behavior in this difficult to reason about parameter, can we somehow clean it up and unify it?

/// This is used to:
/// * avoid disposing the [image] when it is owned by other object (when false)
/// * transfer the [image] ownership to this object (when true)
final bool shouldDisposeImage;
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that ImageInfo has some difficult to reason about behavior.

Rather than encoding that behavior in this difficult to reason about parameter, can we somehow clean it up and unify it?

@polina-c polina-c requested a review from dnfield January 18, 2024 03:08
/// See also:
///
/// * [Image.clone], which describes how and why to clone images.
ImageInfo({
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really have to make this not-const-constructible now? I suspect this will cause problems in Google's monorepo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we need non-const constructor now. May be we will need to update G3 to handle this.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jan 29, 2024
Manual roll requested by [email protected]

flutter/flutter@a8efa77...2f6fdf2

2024-01-26 [email protected] Start renaming by adding a new `bringup: true` as an Android emulator. (flutter/flutter#142257)
2024-01-26 [email protected] Instrument ImageInfo. (flutter/flutter#141411)
2024-01-26 [email protected] Fix `SegmentedButton` default size and default tappable size (flutter/flutter#142243)
2024-01-26 [email protected] Update name for android_defines_test. (flutter/flutter#142273)
2024-01-26 [email protected] Enable native compilation for windows-arm64 (flutter/flutter#141930)
2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Flutter Engine from 4b145d041560 to 44f26274bfbe (6 revisions)" (flutter/flutter#142274)
2024-01-25 [email protected] Run a few mac tests only on arm. (flutter/flutter#142188)
2024-01-25 [email protected] fix Ink not updating on TextField newline (flutter/flutter#140700)
2024-01-25 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 3.1.4 to 3.1.5 (flutter/flutter#142259)
2024-01-25 [email protected] Roll Flutter Engine from 4b145d041560 to 44f26274bfbe (6 revisions) (flutter/flutter#142264)
2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Reverts "Rename `integration_tests/external_ui` but do not touch anything else..."" (flutter/flutter#142268)
2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Rename `integration_tests/external_ui` but do not touch anything else..." (flutter/flutter#142265)
2024-01-25 [email protected] Roll Flutter Engine from b2167a93c1a0 to 4b145d041560 (3 revisions) (flutter/flutter#142256)
2024-01-25 [email protected] Implementing `switch` expressions in the `cupertino/` directory (flutter/flutter#141591)
2024-01-25 [email protected] Rename `integration_tests/external_ui` but do not touch anything else... (flutter/flutter#142238)
2024-01-25 [email protected] Roll Flutter Engine from 55eefd5bd255 to b2167a93c1a0 (2 revisions) (flutter/flutter#142252)
2024-01-25 [email protected] Roll Flutter Engine from 3b4779324b44 to 55eefd5bd255 (6 revisions) (flutter/flutter#142245)
2024-01-25 [email protected] Fix incorrect zh-cn translation for Look Up Label in selection controls (flutter/flutter#142158)
2024-01-25 [email protected] PopScope example improvements (flutter/flutter#142163)
2024-01-25 [email protected] Roll Flutter Engine from 1d3f16b0d62e to 3b4779324b44 (1 revision) (flutter/flutter#142225)
2024-01-25 [email protected] Roll Packages from 8fbdf65 to 21b5abb (6 revisions) (flutter/flutter#142224)
2024-01-25 [email protected] Don't show legacy welcome message when analytics are disabled (flutter/flutter#140956)
2024-01-25 [email protected] Roll Flutter Engine from 7c4ed15cb271 to 1d3f16b0d62e (1 revision) (flutter/flutter#142223)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: leak tracking Issues and PRs related to memory leaks detected by leak_tracker autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants