-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keeping elements around for attribution can leak memory #580
Comments
CC: @adamraine So at the moment we keep a map of the interactionId to Node, and then use that to get the Selector. We also only keep the last 10 entries (to cover the p98 cases) so it's not a "leak" as such (in that it shouldn't grow and grow). However, it might be better to save the map of We should also update #562 to stop make this problem worse. |
Right, but it looks like a leak and is nontheless a memory waste.
You can probably keep a WeakRef to the node, which would return it if it wasn't removed. |
We only need the Map for cases when it is removed. Otherwise we can get it directly from the event timing entry. |
Side note, I think whatever is happening in web-vitals.js is only a part of the problem for this issue. DevTools is doing some extra node retention that may make the problem worse. |
Is this closable now that #585 has landed? |
When we save elements in the node map, they are retained in memory, even after they are removed from the DOM. A DOM element can hold a lot of memory, and also it gets confusing since those retained elements appear in DevTools memory panel.
Perhaps we can retain them as a
WeakRef
, and save the attribution data instead of the node itself when it's removed?https://issues.chromium.org/issues/376777343 is an example that I believe originates from webvitals inside devtools retaining nodes.
/cc @brendankenny @tunetheweb
The text was updated successfully, but these errors were encountered: