[release/10.0.1xx-sr7] Fix iOS/Catalyst MapPool retention with MapElements#35690
Merged
PureWeen merged 1 commit intoJun 2, 2026
Merged
Conversation
### Description of Change Fixes an iOS/Mac Catalyst `MapHandler` pooling leak where a disconnected `MauiMKMapView` was returned to `MapPool` without clearing native map state. If the map contained `MapElement`s, the pooled native map kept overlays alive, which retained the MAUI map elements and their owning page/view-model graph after navigation. The fix prepares pooled map views for reuse by clearing tracked map elements, removing native overlays/annotations, and clearing transient touch state before the native map is added back to the pool. Mac Catalyst repro results using `MapPoolLeakRepro` with 30 pages/run, 40 `MapElement`s/page, 2 MB payload/page, 120 ms dwell/page: | Metric | Before fix | After fix | Change | |---|---:|---:|---:| | MAUI Map views alive | 30/30 | 0/30 | -100.0% | | Payload view models alive | 30/30 | 0/30 | -100.0% | | Map elements alive | 1200/1200 | 0/1200 | -100.0% | | Retained payload | 60.0 MB | 0 B | -100.0% | | Managed heap delta after GC | 63.8 MB | 228.1 KB | -99.7% | | GC heap delta after GC | 65.0 MB | 896.0 KB | -98.7% | Also adds a device regression test covering disconnect/pool cleanup for pins, native annotations, map elements, native overlays, and `MapElementId`. ### Issues Fixed Fixes #35479 --------- Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> (cherry picked from commit 1889fdb)
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 35690Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 35690" |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
This was referenced Jun 2, 2026
Open
This was referenced Jun 2, 2026
Contributor
Author
|
Failures are unrelated |
PureWeen
approved these changes
Jun 2, 2026
This was referenced Jun 10, 2026
Closed
Merged
This was referenced Jun 13, 2026
Open
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Backport of #35480 to
release/10.0.1xx-sr7./cc @PureWeen