Open Bug 1464625 Opened 7 years ago Updated 3 years ago

Large images retained in memory even though they are downscaled

Categories

(Core :: Graphics: ImageLib, defect, P3)

61 Branch
defect

Tracking

()

People

(Reporter: ouellet.rem123, Unassigned)

Details

(Whiteboard: [MemShrink:P2][gfx-noted])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0 Build ID: 20180524181234 Steps to reproduce: For example, go to this website : https://mobilesyrup.com/ Actual results: Memory usage increase to more than 1gb Expected results: A normal memory usage. This issue doesn't happen in Google Chrome.
@mconley I have verified this issue on Beta, version 61.0b9, build1 Gecko profile captured: https://perfht.ml/2J3bb6g I followed the following steps. Steps to reproduce: Go to website : https://mobilesyrup.com/ Actual results: Memory usage increase to more than 1gb What component should it go?
Flags: needinfo?(mconley)
(In reply to Damira Akh from comment #1) > > What component should it go? Hard to say. The Gecko Profiler is not really the best tool to help us diagnose memory problems. Instead, can you reproduce the issue and produce and post a memory report from about:memory? That'll help us narrow into where the memory is going.
Flags: needinfo?(mconley) → needinfo?(dakhmedova)
Flags: needinfo?(dakhmedova)
@mconley I am attaching memory report from about:memory I hope it will give you more info.
Please note that this trouble happens since the first version of firefox quantum. It's not specific to a beta version of firefox 61.
It looks like we're holding a bunch of memory (about half a gig?) on decoded images? Gonna put this in imagelib for now, I guess. Anything actionable here, aosmond?
Component: Untriaged → ImageLib
Flags: needinfo?(aosmond)
Product: Firefox → Core
Okay, this is silly. The images for the stories are huge even though they are sized down by the website. We should handle that fine with downscale during decode except we request a decode at the intrinsic size of the images, and that decode gets the CANNOT_SUBSTITUTE flag. We don't want either of those things to happen. The reason that happens is that in RasterImage::NotifyDecodeComplete when we finish a metadata decode if a full decode has been requested we issue a decode request (because we couldn't until the metadata decode was done). This decode request is at the intrinsic size and passes no flags. Which triggers this code https://dxr.mozilla.org/mozilla-central/rev/763f30c3421233a45ef9e67a695c5c241a2c8a3a/image/RasterImage.cpp#1248 because we didn't pass the high quality scaling flag to label at as cannot substitute. And we don't get rid of these surfaces nearly as easily. We should check if there are any other decode requests that fall into this trap.
Status: UNCONFIRMED → NEW
Ever confirmed: true
There are a few places where we request decoding at the intrinsic size: https://searchfox.org/mozilla-central/rev/38bcf897f1fa19c1eba441a611cf309482e0d6e5/layout/style/ImageLoader.cpp#134,139 https://searchfox.org/mozilla-central/rev/83a923ef7a3b95a516f240a6810c20664b1e0ac9/layout/painting/nsImageRenderer.cpp#126 I expect they are the real problem. Even if CANNOT_SUBSTITUTE was set, we don't trigger the factor of 2 scaling since there are only 2 surfaces. But the native size is a factor of 2 of the native size, so it wouldn't prune that one anyways :). It should get evicted when it always does. I am more annoyed that we are trying to decode ahead of time, and not really use the result because we really want it at a different size. If we requested the decodes later, but fewer of them, the user experience could be just as good. How useful are these signals, really?
Flags: needinfo?(aosmond)
Whiteboard: [MemShrink]
Summary: High memory usage on some websites → Large images retained in memory even though they are downscaled
Whiteboard: [MemShrink] → [MemShrink:P2]
Priority: -- → P3
Whiteboard: [MemShrink:P2] → [MemShrink:P2][gfx-noted]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: