bitwarden / clients

Bitwarden client apps (web, browser extension, desktop, and cli).
https://bitwarden.com
Other
8.98k stars 1.18k forks source link

High Firefox Extension Memory Usage #10222

Open OctopusProteins opened 1 month ago

OctopusProteins commented 1 month ago

Steps To Reproduce

  1. Keep browser open for days-weeks with extension enabled and normal usage
  2. Observe high memory usage as reported by system task manager and Firefox's built-in memory profiler, which reveals this extension as the issue.

Expected Result

None of my other extensions consume more than a couple hundred MB.

Actual Result

After a week or so, Bitwarden was using almost 6 GB of memory. After disabling and reenabling the extension, the usage ballooned to more than 8GB. Usage returns to normal levels after restarting browser.

Screenshots or Videos

No response

Additional Context

There seem to be similar issues reported in other browsers (#2249 #1770).

Operating System

Windows, MacOS

Operating System Version

Version 21H2, Sonoma 14.2.1

Web Browser

Firefox

Browser Version

No response

Build Version

2024.6.3

Issue Tracking Info

HardenedSteel commented 1 month ago

reproducible except restarting the extension didn't cause more memory usage.

OctopusProteins commented 1 month ago

The issue is also present in MacOS (Sonoma 14.2.1), where Bitwarden is presently using ~2GB of RAM, about half that of Firefox overall as verified by the built-in memory profiler.

sammbw commented 1 month ago

Hi there,

I am unable to reproduce this issue, it has been escalated for further investigation. If you have more information that can help us, please add it below.

Thanks!

OctopusProteins commented 1 month ago

Here is the output from Firefox's memory profiler. Not sure how useful this is, if there are other reports or logs that might be helpful I am happy to provide. This is after a couple days of regular usage, and while not as high as previously reported because of the shorter time between resets, the extension is using ~850MB of RAM out of the total 1.2GB used by all extensions (of which I have many), which seems very excessive. I have verified this extension is Bitwarden -- the report is anonymized.

├────991.80 MB (86.80%) -- window-objects
│    ├──853.70 MB (74.72%) -- top(<anonymized-4294967314>, id=40)
│    │  ├──819.64 MB (71.74%) -- active/window(<anonymized-4294967314>)
│    │  │  ├──819.53 MB (71.73%) -- js-realm(<anonymized-17>)
│    │  │  │  ├──816.86 MB (71.49%) -- classes
│    │  │  │  │  ├──273.54 MB (23.94%) -- class(Function)/objects
│    │  │  │  │  │  ├──273.46 MB (23.93%) ── gc-heap
│    │  │  │  │  │  └────0.08 MB (00.01%) ++ malloc-heap
│    │  │  │  │  ├──250.86 MB (21.96%) -- class(Call)/objects
│    │  │  │  │  │  ├──250.84 MB (21.95%) ── gc-heap
│    │  │  │  │  │  └────0.01 MB (00.00%) ── malloc-heap/slots
│    │  │  │  │  ├──184.45 MB (16.14%) -- class(Object)/objects
│    │  │  │  │  │  ├──101.47 MB (08.88%) -- malloc-heap
│    │  │  │  │  │  │  ├──101.44 MB (08.88%) ── slots
│    │  │  │  │  │  │  └────0.03 MB (00.00%) ── elements/normal
│    │  │  │  │  │  └───82.98 MB (07.26%) ── gc-heap
│    │  │  │  │  ├──107.63 MB (09.42%) -- class(Array)/objects
│    │  │  │  │  │  ├──103.00 MB (09.02%) ── gc-heap
│    │  │  │  │  │  └────4.62 MB (00.40%) ++ malloc-heap
│    │  │  │  │  └────0.39 MB (00.03%) ++ (7 tiny)
│    │  │  │  └────2.68 MB (00.23%) ++ (7 tiny)
│    │  │  └────0.11 MB (00.01%) ++ (3 tiny)
│    │  └───34.06 MB (02.98%) -- js-zone(0x208d540c200)
│    │      ├──18.18 MB (01.59%) ++ (17 tiny)
│    │      └──15.88 MB (01.39%) -- strings
│    │         ├──13.41 MB (01.17%) ++ malloc-heap
│    │         └───2.47 MB (00.22%) ++ gc-heap
dchusovitin commented 1 month ago

Same problem, the extension is using ~1.7G of RAM, after 10 days. Firefox 128.0, Linux

│  ├──1,690.91 MB (65.71%) -- top(moz-extension://9fe4e99f/background.html, id=47)
│  │  ├──1,651.05 MB (64.16%) -- active/window(moz-extension://9fe4e99f/background.html)
│  │  │  ├──1,650.96 MB (64.16%) -- js-realm(moz-extension://9fe4e99f/background.html)
│  │  │  │  ├──1,648.55 MB (64.06%) -- classes
│  │  │  │  │  ├────548.92 MB (21.33%) -- class(Function)/objects
│  │  │  │  │  │    ├──548.84 MB (21.33%) ── gc-heap
│  │  │  │  │  │    └────0.08 MB (00.00%) ++ malloc-heap
│  │  │  │  │  ├────504.64 MB (19.61%) -- class(Call)/objects
│  │  │  │  │  │    ├──504.62 MB (19.61%) ── gc-heap
│  │  │  │  │  │    └────0.01 MB (00.00%) ── malloc-heap/slots
│  │  │  │  │  ├────368.00 MB (14.30%) -- class(Object)/objects
│  │  │  │  │  │    ├──202.28 MB (07.86%) -- malloc-heap
│  │  │  │  │  │    │  ├──202.25 MB (07.86%) ── slots
│  │  │  │  │  │    │  └────0.03 MB (00.00%) ── elements/normal
│  │  │  │  │  │    └──165.72 MB (06.44%) ── gc-heap
│  │  │  │  │  ├────226.60 MB (08.81%) -- class(Array)/objects
│  │  │  │  │  │    ├──219.72 MB (08.54%) ── gc-heap
│  │  │  │  │  │    └────6.88 MB (00.27%) ++ malloc-heap
│  │  │  │  │  └──────0.39 MB (00.02%) ++ (7 tiny)
│  │  │  │  └──────2.41 MB (00.09%) ++ (7 tiny)
│  │  │  └──────0.09 MB (00.00%) ++ (3 tiny)
│  │  └─────39.86 MB (01.55%) ++ js-zone(0x7ea9089f2c00)
marceldev89 commented 1 month ago

This has been happening for a long time now.. It's starting to becoming really annoying... Using nearly 2GB, just today and for what? 🤷

│  ├──1,905.38 MB (92.56%) -- top(moz-extension://7263675a-e70e-4211-81ca-32b449a18978/background.html, id=42)
│  │  ├──1,868.61 MB (90.77%) -- active/window(moz-extension://7263675a-e70e-4211-81ca-32b449a18978/background.html)
│  │  │  ├──1,868.55 MB (90.77%) -- js-realm(moz-extension://7263675a-e70e-4211-81ca-32b449a18978/background.html)
│  │  │  │  ├──1,866.17 MB (90.66%) -- classes
│  │  │  │  │  ├────623.59 MB (30.29%) -- class(Function)/objects
│  │  │  │  │  │    ├──623.52 MB (30.29%) ── gc-heap
│  │  │  │  │  │    └────0.07 MB (00.00%) ++ malloc-heap
│  │  │  │  │  ├────573.69 MB (27.87%) -- class(Call)/objects
│  │  │  │  │  │    ├──573.68 MB (27.87%) ── gc-heap
│  │  │  │  │  │    └────0.01 MB (00.00%) ── malloc-heap/slots
│  │  │  │  │  ├────417.54 MB (20.28%) -- class(Object)/objects
│  │  │  │  │  │    ├──229.33 MB (11.14%) ++ malloc-heap
│  │  │  │  │  │    └──188.21 MB (09.14%) ── gc-heap
│  │  │  │  │  ├────251.18 MB (12.20%) -- class(Array)/objects
│  │  │  │  │  │    ├──244.34 MB (11.87%) ── gc-heap
│  │  │  │  │  │    └────6.84 MB (00.33%) ++ malloc-heap
│  │  │  │  │  └──────0.17 MB (00.01%) ++ (5 tiny)
│  │  │  │  └──────2.38 MB (00.12%) ++ (6 tiny)
│  │  │  └──────0.06 MB (00.00%) ++ (3 tiny)
│  │  └─────36.77 MB (01.79%) -- js-zone(0x70fd47a17200)
│  │        ├──24.32 MB (01.18%) ── gc-heap-arena-admin
│  │        └──12.45 MB (00.60%) ++ (16 tiny)
marceldev89 commented 1 month ago

Just hit 4GB... turning off the extensions made it grow to a huge 10GB before coming down.. This is ridiculous...

soulwa commented 3 weeks ago

noticed firefox taking up a lot of memory and it was similarly bitwarden using ~2.5GB of RAM, out of 3GB total from extensions

2,756.98 MB (100.0%) -- explicit
├──2,515.67 MB (91.25%) -- window-objects
│  ├──2,474.76 MB (89.76%) -- top(<anonymized-2147483690>, id=1658)
│  │  ├──2,400.23 MB (87.06%) -- active/window(<anonymized-2147483690>)
│  │  │  ├──2,400.13 MB (87.06%) -- js-realm(<anonymized-15>)
│  │  │  │  ├──2,397.45 MB (86.96%) -- classes
│  │  │  │  │  ├────801.12 MB (29.06%) -- class(Function)/objects
│  │  │  │  │  │    ├──801.04 MB (29.05%) ── gc-heap
│  │  │  │  │  │    └────0.08 MB (00.00%) ++ malloc-heap
│  │  │  │  │  ├────736.58 MB (26.72%) -- class(Call)/objects
│  │  │  │  │  │    ├──736.57 MB (26.72%) ── gc-heap
│  │  │  │  │  │    └────0.01 MB (00.00%) ── malloc-heap/slots
│  │  │  │  │  ├────540.15 MB (19.59%) -- class(Object)/objects
│  │  │  │  │  │    ├──296.96 MB (10.77%) -- malloc-heap
│  │  │  │  │  │    │  ├──296.93 MB (10.77%) ── slots
│  │  │  │  │  │    │  └────0.03 MB (00.00%) ── elements/normal
│  │  │  │  │  │    └──243.19 MB (08.82%) ── gc-heap
│  │  │  │  │  ├────318.58 MB (11.56%) -- class(Array)/objects
│  │  │  │  │  │    ├──305.67 MB (11.09%) ── gc-heap
│  │  │  │  │  │    └───12.91 MB (00.47%) ++ malloc-heap
│  │  │  │  │  └──────1.02 MB (00.04%) ++ (8 tiny)
│  │  │  │  └──────2.68 MB (00.10%) ++ (7 tiny)
│  │  │  └──────0.10 MB (00.00%) ++ (3 tiny)
│  │  └─────74.53 MB (02.70%) -- js-zone(0x12a7b2000)
│  │        ├──36.68 MB (01.33%) -- strings
│  │        │  ├──33.74 MB (01.22%) -- malloc-heap
│  │        │  │  ├──30.84 MB (01.12%) ── two-byte
│  │        │  │  └───2.90 MB (00.11%) ── latin1
│  │        │  └───2.94 MB (00.11%) ++ gc-heap
│  │        ├──31.22 MB (01.13%) ── gc-heap-arena-admin
│  │        └───6.64 MB (00.24%) ++ (16 tiny)
│  └─────40.91 MB (01.48%) ++ (12 tiny)

Bitwarden Version: 2024.7.1 Browser: Firefox 128.0.3 OS: Sonoma 14.5 on an Intel 2019 Mac with 32GB RAM