Closed Bug 1392547 Opened 7 years ago Closed 5 years ago

Excessive Memory Usage (3x Chrome) with mapbox-gl

Categories

(Core :: JavaScript Engine, defect, P2)

Unspecified
Windows 10
defect

Tracking

()

RESOLVED FIXED
Tracking Status
firefox57 --- fix-optional

People

(Reporter: zac.spitzer, Assigned: sfink)

References

(Blocks 1 open bug)

Details

(Keywords: memory-footprint, Whiteboard: [MemShrink:P2])

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36

Steps to reproduce:

The following test case crashes Safari
https://kristfal.github.io/mapbox-memory-test/
from https://bugs.webkit.org/show_bug.cgi?id=172790#c6


Actual results:

Firefox nightly doesn't crash, but it does end up using more than 1.2GB of ram

https://perf-html.io/from-addon/calltree/?hiddenThreads=&thread=2&threadOrder=0-2-3-4-6-1-5


Expected results:

Chrome only uses about 400MB of ram
OS: Unspecified → Windows 10
Summary: Excessive Memory Usage with mapbox-gl → Excessive Memory Usage (3x Chrome) with mapbox-gl
Component: Untriaged → Canvas: WebGL
Keywords: footprint
Product: Firefox → Core
Most of the memory is used by ArrayBuffers, so to the js engine I guess.

1,082.31 MB (100.0%) -- explicit
├────752.57 MB (69.53%) -- workers/workers(kristfal.github.io)
│    ├──253.80 MB (23.45%) -- worker(blob:https://kristfal.github.io/480212d8-7f5d-1848-8912-487a37864a58, 0x11d14e000)
│    │  ├──242.42 MB (22.40%) -- zone(0x11d240000)
│    │  │  ├──211.55 MB (19.55%) -- compartment(web-worker)
│    │  │  │  ├──203.53 MB (18.81%) -- classes
│    │  │  │  │  ├──136.99 MB (12.66%) -- class(ArrayBuffer)/objects
│    │  │  │  │  │  ├──132.20 MB (12.21%) ── malloc-heap/elements/normal
│    │  │  │  │  │  └────4.79 MB (00.44%) ── gc-heap
│    │  │  │  │  ├───40.64 MB (03.76%) -- class(Object)/objects
│    │  │  │  │  │   ├──35.50 MB (03.28%) ── gc-heap
│    │  │  │  │  │   └───5.15 MB (00.48%) ++ malloc-heap
│    │  │  │  │  ├───14.89 MB (01.38%) -- class(Array)/objects
│    │  │  │  │  │   ├──12.11 MB (01.12%) ── gc-heap
│    │  │  │  │  │   └───2.78 MB (00.26%) ++ malloc-heap
│    │  │  │  │  └───11.00 MB (01.02%) ++ (11 tiny)
│    │  │  │  └────8.02 MB (00.74%) ++ (8 tiny)
│    │  │  ├───16.87 MB (01.56%) ++ strings
│    │  │  └───14.00 MB (01.29%) ++ (14 tiny)
│    │  └───11.38 MB (01.05%) ++ (3 tiny)
│    ├──196.87 MB (18.19%) -- worker(blob:https://kristfal.github.io/480212d8-7f5d-1848-8912-487a37864a58, 0x11d152800)
│    │  ├──185.77 MB (17.16%) -- zone(0x129cb5000)
│    │  │  ├──159.41 MB (14.73%) -- compartment(web-worker)
│    │  │  │  ├──151.33 MB (13.98%) -- classes
│    │  │  │  │  ├──101.82 MB (09.41%) -- class(ArrayBuffer)/objects
│    │  │  │  │  │  ├───98.21 MB (09.07%) ── malloc-heap/elements/normal
│    │  │  │  │  │  └────3.61 MB (00.33%) ── gc-heap
│    │  │  │  │  ├───26.92 MB (02.49%) -- class(Object)/objects
│    │  │  │  │  │   ├──21.00 MB (01.94%) ── gc-heap
│    │  │  │  │  │   └───5.92 MB (00.55%) ++ malloc-heap
│    │  │  │  │  ├───13.62 MB (01.26%) ++ class(Array)/objects
│    │  │  │  │  └────8.97 MB (00.83%) ++ (11 tiny)
│    │  │  │  └────8.08 MB (00.75%) ++ (8 tiny)
│    │  │  ├───13.98 MB (01.29%) ++ strings
│    │  │  └───12.38 MB (01.14%) ++ (14 tiny)
│    │  └───11.10 MB (01.03%) ++ (3 tiny)
│    ├──173.46 MB (16.03%) -- worker(blob:https://kristfal.github.io/480212d8-7f5d-1848-8912-487a37864a58, 0x11d14f000)
│    │  ├──162.92 MB (15.05%) -- zone(0x1268d6000)
│    │  │  ├──135.70 MB (12.54%) -- compartment(web-worker)
│    │  │  │  ├──127.50 MB (11.78%) -- classes
│    │  │  │  │  ├───87.28 MB (08.06%) -- class(ArrayBuffer)/objects
│    │  │  │  │  │   ├──84.22 MB (07.78%) ── malloc-heap/elements/normal
│    │  │  │  │  │   └───3.06 MB (00.28%) ── gc-heap
│    │  │  │  │  ├───23.20 MB (02.14%) -- class(Object)/objects
│    │  │  │  │  │   ├──15.59 MB (01.44%) ── gc-heap
│    │  │  │  │  │   └───7.61 MB (00.70%) ++ malloc-heap
│    │  │  │  │  └───17.03 MB (01.57%) ++ (12 tiny)
│    │  │  │  └────8.20 MB (00.76%) ++ (8 tiny)
│    │  │  └───27.21 MB (02.51%) ++ (15 tiny)
│    │  └───10.54 MB (00.97%) ++ (3 tiny)
│    └──128.44 MB (11.87%) -- worker(blob:https://kristfal.github.io/480212d8-7f5d-1848-8912-487a37864a58, 0x11d158800)
│       ├──117.75 MB (10.88%) -- zone(0x1268d7000)
│       │  ├───79.03 MB (07.30%) -- compartment(web-worker)
│       │  │   ├──72.42 MB (06.69%) -- classes
│       │  │   │  ├──43.32 MB (04.00%) -- class(ArrayBuffer)/objects
│       │  │   │  │  ├──41.74 MB (03.86%) ── malloc-heap/elements/normal
│       │  │   │  │  └───1.58 MB (00.15%) ── gc-heap
│       │  │   │  ├──18.72 MB (01.73%) -- class(Object)/objects
│       │  │   │  │  ├──11.83 MB (01.09%) ── gc-heap
│       │  │   │  │  └───6.89 MB (00.64%) ++ malloc-heap
│       │  │   │  └──10.38 MB (00.96%) ++ (11 tiny)
│       │  │   └───6.60 MB (00.61%) ++ (8 tiny)
│       │  ├───27.89 MB (02.58%) ── unused-gc-things
│       │  └───10.83 MB (01.00%) ++ (14 tiny)
│       └───10.69 MB (00.99%) ++ (3 tiny)
├────134.88 MB (12.46%) -- window-objects
│    ├──127.25 MB (11.76%) -- top(https://kristfal.github.io/mapbox-memory-test/, id=2147483649)
│    │  ├───94.33 MB (08.72%) -- active/window(https://kristfal.github.io/mapbox-memory-test/)
│    │  │   ├──93.35 MB (08.62%) -- js-compartment(https://kristfal.github.io/mapbox-memory-test/)
│    │  │   │  ├──86.11 MB (07.96%) -- classes
│    │  │   │  │  ├──48.76 MB (04.51%) -- class(ArrayBuffer)/objects
│    │  │   │  │  │  ├──47.46 MB (04.39%) ── malloc-heap/elements/normal
│    │  │   │  │  │  └───1.30 MB (00.12%) ── gc-heap
│    │  │   │  │  ├──18.79 MB (01.74%) ++ class(Object)/objects
│    │  │   │  │  └──18.55 MB (01.71%) ++ (15 tiny)
│    │  │   │  └───7.24 MB (00.67%) ++ (9 tiny)
│    │  │   └───0.98 MB (00.09%) ++ (3 tiny)
│    │  ├───29.52 MB (02.73%) -- js-zone(0x11aaaf000)
│    │  │   ├──17.82 MB (01.65%) ++ (15 tiny)
│    │  │   └──11.69 MB (01.08%) ++ strings
│    │  └────3.41 MB (00.31%) ++ cached/window(https://www.mozilla.org/en-US/firefox/57.0a1/whatsnew/?oldversion=55.0.3)
│    └────7.63 MB (00.70%) ++ top(about:newtab, id=2147483652)
Component: Canvas: WebGL → JavaScript Engine
Whiteboard: [MemShrink]
Also on Nightly / Linux / x64.  I let this run for a while.  It hits 2GB pretty quickly (as seen in the Ubuntu System Monitor, which is very crude) then has a sawtooth pattern between 2GB and 2.6GB.  There's really no indication that it's leaking per se, the floor stays around 2GB (again with these crude tools).

Chromium on the same system seems to have a floor starting around 550MB for its content process but then growing slowly, and then the same sawtooth on top of that.  (It also renders the map quite a bit better than Firefox.)
Steve: Is this something we can reasonably address in FF57?
Assignee: nobody → sphink
Flags: needinfo?(sphink)
Priority: -- → P2
Whiteboard: [MemShrink] → [MemShrink:P2]
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(sphink)

Refreshing the needinfo. This bug is mentioned in this Twitter thread mentioned on IRC: https://twitter.com/zackster/status/1081164687419625477

Flags: needinfo?(sphink)
Blocks: GCScheduling
Flags: needinfo?(sphink)

Lots of workers stuff there. Is this related to bug 1216175

Blocks: 1533449
No longer blocks: GCScheduling

This no longer reproduces for me in nightly. 68 and 69 show content process size of 1GB and increasing. In 70 content process stays around 350MB.

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.