Skip to content

Fix MAUI MapControl memory leak (SKGLView not released after navigation)#3273

Open
MereDoku wants to merge 3 commits intoMapsui:mainfrom
MereDoku:fix/maui-mapcontrol-memory-leak
Open

Fix MAUI MapControl memory leak (SKGLView not released after navigation)#3273
MereDoku wants to merge 3 commits intoMapsui:mainfrom
MereDoku:fix/maui-mapcontrol-memory-leak

Conversation

@MereDoku
Copy link
Copy Markdown

Fixes #3271

Summary

This PR fixes a memory leak in Mapsui.Maui.MapControl where MapControl and the underlying
SKGLView were not garbage collected after navigating away from a page.

Repro

https://github.com/MereDoku/Mapsui.Maui.MemoryLeak.Repro

Changes

  • Disconnect MAUI handlers / clear native view references to allow GC
  • Stop MyLocationLayer animation on cleanup
  • Ensure MapView no longer keeps strong references after view is removed

How to test

  1. Run the repro project
  2. Navigate to MapPage and back multiple times
  3. Run VisualLeakCheckQueue.Monitor()
  4. Verify MapControl and SKGLView are collected

Platforms tested

  • WinUI ✅
  • Android ✅
  • iOS ✅

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.

[MAUI 5.0.2] MapControl is not garbage collected after page navigation (SKGLView memory leak)

1 participant