GoogleChrome / web-vitals-extension

A Chrome extension to measure essential metrics for a healthy site
https://chrome.google.com/webstore/detail/web-vitals/ahfhijdlegdabablpippeagghigmibma?hl=en
Apache License 2.0
2.35k stars 105 forks source link

[Memory usage] Background script #71

Closed addyosmani closed 4 years ago

addyosmani commented 4 years ago

Describe the bug

It looks like we may have some additional memory leaks sitting around 🚿 Once all tabs that are badged are closed, memory usage from the extension remains in the ~50MBs on my machine.

Screen Shot 2020-06-23 at 6 42 59 PM

This continues to grow if left open for a few minutes.

image

To Reproduce

  1. Open four tabs in sequence - web.dev, cnn.com, theverge.com, disney.com
  2. Wait for the tabs to fully load
  3. Measure extension's memory consumption and CPU utilization using Chrome's Task Manager
  4. Close all open tabs except about:extensions
  5. Measure extension's memory consumption and CPU utilization using Chrome's Task Manager

This appears to also be present after #68 and #69 cc @patrickhulce as an fyi

patrickhulce commented 4 years ago

Measure extension's memory consumption and CPU utilization using Chrome's Task Manager

This is the part of this I don't trust here :) Every time I inspected the extension itself with DevTools all memory usage was low and/or eventually GC'd after #69

While the memory does grow for a few minutes in Chrome's task manager. It all appears to be the virtual DOM elements/listeners created by Chrome extension APIs and the periodic animations the extension does and can all be GC'd. (notice the enormous cliff after nodes hit ~600) image

There is some cleanup we can do for ending animations earlier though.