Skip to content

Image widget can use large memory and never released  #62107

@Gorniv

Description

@Gorniv

Details

Image.asset use from 100 to 240 Mb for One image:

Image.asset(
          'assets/icon_app/meows_splash.png', 
          fit: BoxFit.cover,
          width: width,
          height: width,
        )
Image for test ![meows_splash](https://user-images.githubusercontent.com/963316/88263474-c5aeff00-ccd2-11ea-8208-566e4209cffe.png)

I tested on ios physical device with Profile mode.

Run flutter app without Image.asset:
Run flutter app without image.

Run with Image on 1.17.5 :
Screenshot 2020-07-22 at 08 42 29

Run with Image on 1.21.0-2.0.pre94:
Screenshot 2020-07-22 at 08 52 49

I found workaround - use cacheWidth

Image.asset(
          'assets/icon_app/meows_splash.png', 
          fit: BoxFit.cover,
          width: width,
          height: width,
          cacheWidth: width ~/ 1,
          cacheHeight: width  ~/ 1,
        )

Run workaround:
Screenshot 2020-07-22 at 09 55 23

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: imagesLoading, displaying, rendering imagesc: performanceRelates to speed or footprint issues (see "perf:" labels)customer: crowdAffects or could affect many people, though not necessarily a specific customer.d: api docsIssues with https://api.flutter.dev/found in release: 1.17Found to occur in 1.17found in release: 1.21Found to occur in 1.21frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onperf: memoryPerformance issues related to memoryr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions