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 leaks in MAUI views #2955

Merged
merged 1 commit into from
Jul 26, 2024
Merged

Fix memory leaks in MAUI views #2955

merged 1 commit into from
Jul 26, 2024

Conversation

mattleibow
Copy link
Contributor

Description of Change

It is very easy to create a circular reference in iOS and we had a few. When you have an event from a platform view to another instance that then references that platform view, you get an un-collectable set.

This PR breaks this chain by making the platform view have an event on a proxy object that has a weak reference to handlers and/or virtual views.

Bugs Fixed

API Changes

None.

Behavioral Changes

None.

Required skia PR

None.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Merged related skia PRs
  • Changes adhere to coding standard
  • Updated documentation

@mattleibow mattleibow added the backport/release/2.x Backport this PR to release/2.x label Jul 23, 2024
@mattleibow mattleibow changed the base branch from dev/updates to main July 24, 2024 18:20
@mattleibow mattleibow linked an issue Jul 24, 2024 that may be closed by this pull request
1 task
@mattleibow mattleibow merged commit ccde024 into main Jul 26, 2024
1 of 2 checks passed
@mattleibow mattleibow deleted the dev/fix-mem-leak branch July 26, 2024 08:14
Copy link

The backport to release/2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release/2.x release/2.x
# Navigate to the new working tree
cd .worktrees/backport-release/2.x
# Create a new branch
git switch --create backport/pr-2955-to-release/2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 ccde024b628e4454dfc713fb3f6f27f071883b79
# Push it to GitHub
git push --set-upstream origin backport/pr-2955-to-release/2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release/2.x

Then, create a pull request where the base branch is release/2.x and the compare/head branch is backport/pr-2955-to-release/2.x.

@albilaga
Copy link

albilaga commented Sep 17, 2024

@mattleibow this one is only on 3.0.0 right? 2.88 is not possible?

Looks like even in 3.0.0 preview 4 is not available yet.

@mattleibow
Copy link
Contributor Author

mattleibow commented Sep 18, 2024

Preview 4 is out 2 months ago: https://www.nuget.org/packages/SkiaSharp/3.0.0-preview.4.1

I am getting ready to push preview 5 out with some extra things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/release/2.x Backport this PR to release/2.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] .Net MAUI SKCanvasView memory leak on IOS
2 participants