Open Bug 1213245 Opened 9 years ago Updated 1 year ago

background image (background-size: cover;) causes memory leak when the browser window is resized.

Categories

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

41 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: inthewoodsbg, Unassigned)

References

(Depends on 1 open bug, )

Details

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

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0
Build ID: 20150929144111

Steps to reproduce:

Create a blank webpage with only one big picture attached as background.
This page can be used as an example: https://css-tricks.com/examples/FullPageBackgroundImage/progressive.php


Actual results:

When you resize the browser window the memory usage increases drastically. I was testing some responsive designs for my personal site when I experienced the issue. Just start dragging the bottom right corner of the browser around for a couple of seconds and you will notice huge memory leak. It can consume more than 1GB easily before the browser crashes.


Expected results:

No additional memory should be occupied by simply resizing the browser window.
Component: Untriaged → General
OS: Unspecified → Windows 8.1
Hardware: Unspecified → x86_64
Whiteboard: [MemShrink]
WFM on Win10 Fx43, the memory slow increase and decline. But it may depend on it.
Depends on: 1123976
OS: Windows 8.1 → Unspecified
Hardware: x86_64 → Unspecified
Sounds like downscale during decode could be asking for a lot of decodes at different sizes. We considered the case where the scale of an image was animating, but not a browser resize. Ideally we would avoid doing all these decodes for images that are shown for a split second only, but at least we should discard a little quicker in a case like this. Not sure how to detect that though.
Flags: needinfo?(seth)
Component: General → ImageLib
Product: Firefox → Core
Whiteboard: [MemShrink] → [MemShrink:P1]
I had trouble reproducing this on Windows, Mac and Linux. On Mac memory went up a bit, on the others it hardly changed.
I came here while digging through a bug in Reddit Enhancement Suite's image viewer [1] that might be the same problem as this one. RES allows you to resize images by clicking and dragging, and this appears to trigger the behavior being discussed here.

I've created a repro of the behavior, attached, which places an enormous strain on CPU and memory resources by rescaling an image repeatedly (Win10 FF43.0.4 x86_64). about:memory indicates that every intermediate size is kept in memory:

├────687.03 MB (33.70%) -- images
│    ├──679.05 MB (33.31%) -- content
│    │  ├──678.86 MB (33.30%) -- raster/used
│    │  │  ├──670.07 MB (32.87%) -- image(1024x683, https://css-tricks.com/examples/FullPageBackgroundImage/images/bg.jpg)
│    │  │  │  ├──521.16 MB (25.56%) -- unlocked
│    │  │  │  │  ├────2.67 MB (00.13%) ++ surface(1024x683@0)
│    │  │  │  │  ├────2.66 MB (00.13%) ++ surface(1021x681@0)
│    │  │  │  │  ├────2.66 MB (00.13%) ++ surface(1022x681@0)
│    │  │  │  │  ├────2.64 MB (00.13%) ++ surface(1018x679@0)
│    │  │  │  │  ├────2.64 MB (00.13%) ++ surface(1019x679@0)
│    │  │  │  │  ├────2.64 MB (00.13%) ++ surface(1018x678@0)
│    │  │  │  │  ├────2.63 MB (00.13%) ++ surface(1015x677@0)

and so on.  This is a synthetic test case to make it easier to observe the behavior, but it does cause real issues for users.

[1] https://www.reddit.com/r/RESissues/comments/41q8lh/bug_insane_cpu_and_memory_usage_on_reisize_for/
Whiteboard: [MemShrink:P1] → [MemShrink:P1][gfx-noted]
it seems that v45.0.1 has fixed it? anyone else test it?
Whiteboard: [MemShrink:P1][gfx-noted] → [MemShrink:P2][gfx-noted]

Clear a needinfo that is pending on an inactive user.

Inactive users most likely will not respond; if the missing information is essential and cannot be collected another way, the bug maybe should be closed as INCOMPLETE.

For more information, please visit auto_nag documentation.

Flags: needinfo?(seth.bugzilla)

Tried the testcase in comment 0 (resizing the window) and the attached testcase, could not reproduce increased memory usage.

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: