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

[Proposal] Make SharedReference's clearSignal param mandatory #1592

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

peaBerberian
Copy link
Collaborator

NOTE: Most updates here are prettier being prettier and re-indenting things. No logic beside one handling the clearSignal parameter should have been updated.

We've seen minor memory leaks in the project due to forgetting to clean-up what's basically event listeners (mainly JS-only ones, not DOM ones).

To put a supplementary level of security against memory leaks, I propose here to make the SharedReference and any IPlaybackObserver's clearSignal parameter as mandatory.

Note that this is not always needed to clean up a listener, there's for example the stopListening argument provided in the callback, "finishing" the reference etc., so a reference without a CancellationSignal could still not be leaking, but ensuring there's a CancellationSignal also attached looks like a minor sacrifice to limit memory leaks to me.

We've seen minor memory leaks in the project due to forgetting to clean-up
what's basically event listeners (mainly JS-only ones, not DOM ones).

To put a supplementary level of security against memory leaks, I propose
here to make the `SharedReference` and any `IPlaybackObserver`'s
`clearSignal` parameter as mandatory.

Note that this is not always needed to clean up a listener, there's for
example the `stopListening` argument provided in the callback, "finishing"
the reference etc., so a reference without a CancellationSignal could
still not be leaking, but ensuring there's a CancellationSignal also
attached looks like a minor sacrifice to limit memory leaks to me.
@peaBerberian peaBerberian added the proposal This Pull Request or Issue is only a proposal for a change with the expectation of a debate on it label Nov 12, 2024
Copy link
Collaborator

@Florent-Bouisset Florent-Bouisset left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@peaBerberian peaBerberian merged commit 0a66b5c into dev Nov 15, 2024
11 checks passed
@peaBerberian peaBerberian added this to the 4.3.0 milestone Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal This Pull Request or Issue is only a proposal for a change with the expectation of a debate on it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants