Skip to content

Remove in memory decoded frame cache #26081

@mklim

Description

@mklim

codec.cc tries to cache as many of the decoded animated image frames in memory as possible, up to a ratio based on the size of the original image. This saves the CPU/battery that would be used to decode the frames on subsequent loops of the image but isn't strictly necessary, takes up a large amount of memory, and has caused multiple bugs in the past based on flutter apps using too much memory. Even with the ratio and various memory fixes in place it's still possible for Flutter apps to crash with OOM exceptions playing animated images if the code doesn't lower the ratio to 1.0 manually (effectively disabling the cache) and try to display multiple large images at once.

Moving forward it would be better to just remove the bonus cache entirely. This does introduce a regression on the CPU/battery side for the case of apps that are displaying a single small image with just a few frames, but that tradeoff is probably better than the occasional OOM crashes we have now.

Some of the previous issues and discussion around the memory issues with the decoded cache:

/cc @amirh

Metadata

Metadata

Assignees

Labels

c: API breakBackwards-incompatible API changesc: performanceRelates to speed or footprint issues (see "perf:" labels)engineflutter/engine related. See also e: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions