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

Fixes #1702: Fixed Memory Leak in MediaElement #1736

Merged
merged 1 commit into from
Mar 7, 2024
Merged

Fixes #1702: Fixed Memory Leak in MediaElement #1736

merged 1 commit into from
Mar 7, 2024

Conversation

marco-skizza
Copy link
Contributor

Description of Change

Fixed Memory Leak in MediaElement.
The timer is now disposed as well.

Linked Issues

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls

Additional information

Tested on: WinUI, Android, iOS

My Issues hasn't been approved yet, but I thought I nevertheless share my findings with this PR.
I hope you can merge it, in order to improve memory management for people using the MediaElement.

P.S.:
As mentioned in the Issue, besides disposing the handler, I had to dispose the MediaElement itself as well to get rid of the Memory Leak:

        MyMediaElement.Handler?.DisconnectHandler();
        MyMediaElement.Dispose();

But I think this can be added to the docu+sample later on...

Many thanks!

@marco-skizza
Copy link
Contributor Author

@dotnet-policy-service agree company="Kanton Luzern"

Copy link
Member

@pictos pictos left a comment

Choose a reason for hiding this comment

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

Good catch!

@brminnick brminnick enabled auto-merge (squash) March 7, 2024 21:05
@brminnick brminnick merged commit af42a4b into CommunityToolkit:main Mar 7, 2024
7 checks passed
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.

[BUG] MediaElement is not currently being Garbage Collected
3 participants