Skip to content
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

fix: Memory leak caused by caching event objects #307

Closed
wants to merge 1 commit into from

Conversation

gaoyuan123
Copy link

The event object is not cleared after reporting, causing the dom to be cached

@Oscurz
Copy link

Oscurz commented Jan 13, 2023 via email

@gaoyuan123
Copy link
Author

What type of info is leaking.

On Fri, Jan 13, 2023, 1:46 AM gaoyuan123 @.> wrote: The event object is not cleared after reporting, causing the dom to be cached ------------------------------ You can view, comment on, or merge this pull request online at: #307 Commit Summary - ec86bba <ec86bba> fix: Memory leak caused by caching event objects File Changes (1 file https://github.com/GoogleChrome/web-vitals/pull/307/files) - M src/lib/polyfills/firstInputPolyfill.ts https://github.com/GoogleChrome/web-vitals/pull/307/files#diff-a2d2026423041483bca4d5fe0543fec839b1741f63cf0b38a08f9e6959a6f7ba (1) Patch Links: - https://github.com/GoogleChrome/web-vitals/pull/307.patch - https://github.com/GoogleChrome/web-vitals/pull/307.diff — Reply to this email directly, view it on GitHub <#307>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWSXWJGSYOX3UBGGB2TKMSTWSEP6TANCNFSM6AAAAAAT2GTGZQ . You are receiving this because you are subscribed to this thread.Message ID: @.>

You can look at the submission. In the firstInputPolyfill.ts file, there are two variables: firstInputEvent and callbacks cache the user's first interaction event and callback method respectively. In the reportFirstInputDelayIfRecordedAndValid method, the callbacks cache is cleared, but firstInputEvent is not cleaned up, The target in the event attribute points to dom.

@tunetheweb
Copy link
Member

Closing this as we plan to deprecate the FID Polyfill in v4 as per #238

@tunetheweb tunetheweb closed this Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants