Memory leak in CameraAnimatorsRunner (11.31.1)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- swift
- Ambito
- performance
Direzione di ricerca
Start in Sources/MapboxMaps/Camera/CameraAnimatorsRunner.swift: add(_ animator:) appends each onCameraAnimatorStatusChanged subscription to cancelables and nothing prunes them, so entries outlive their animators. Read how AnyCancelable and ClosureHandlersStore interact to find a safe point to drop cancelled subscriptions (the suggested pruning on next add() is one option). Verify with Instruments/leak counts over a simulated navigation run, mimicking the growth of ClosureHandlersStore<CameraAnimatorStatus, ()> described in the report; done means instance counts stay flat over a long run.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Versions: mapbox-maps-ios 11.31.1 with mapbox-navigation-ios 3.31.1. CameraAnimatorsRunner.swift on main is byte-for-byte the same as in 11.31.1.
In Sources/MapboxMaps/Camera/CameraAnimatorsRunner.swift, add(_ animator:) stores each animator's onCameraAnimatorStatusChanged subscription in the cancelables set. Nothing ever removes it, so every subscription stays alive until the MapView is deallocated, even after the animator itself has been released. The AnyCancelable returned by ClosureHandlersStore.add(handler:) holds a strong reference to the animator's ClosureHandlersStore and its handler, so each animator leaves behind two NSLocks.
During navigation this grows non-stop. In following mode, NavigationCameraStateTransition.update(to:state:) in the Navigation SDK creates 2-6 new animators on every camera update (zoom and padding are animated even when unchanged), about 5 times a second.
Measured: ClosureHandlersStore<CameraAnimatorStatus, ()> instances grew from 132 to 11,645 over about 2,300 s of simulated driving (about 6 MB). AnyCancelable, ObjectWrapper and NSLock grew at the same rate. There was only one CameraAnimatorsRunner the whole time.
Suggested fix: remove a subscription once its animator has been released, for example by pruning the set on the next add() call. This doesn't change how the camera behaves.
- Lingua principale
- Swift
- Stelle
- 601
- Fork
- 198
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di mapbox/mapbox-maps-ios
-
auto-triaged bug :beetle: p3 SwiftUI
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
mapbox/mapbox-maps-ios#2452 · 6 reazioni ·
-
auto-triaged bug :beetle: p2
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
mapbox/mapbox-maps-ios#2451 ·
-
auto-triaged bug :beetle: needs info p3 performance :zap:
Difficoltà 5/5 Più di una settimana Idoneità per principianti 22/100
mapbox/mapbox-maps-ios#2450 · 1 commento ·
-
auto-triaged bug :beetle: p1
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
mapbox/mapbox-maps-ios#2449 · 5 commenti ·
-
auto-triaged bug :beetle: p2 performance :zap:
Difficoltà 3/5 1-2 giorni Idoneità per principianti 69/100
mapbox/mapbox-maps-ios#2447 ·
Tutte le issue di mapbox/mapbox-maps-ios
Issue simili
-
🎉 Add BossanovaAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
jaywcjlove/awesome-mac#4096 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
[BUG] FluidMeet: Google Meet browser calls not detected after Meet moved rooms to /meet/<code>Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
altic-dev/FluidVoice#1264 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage S3: minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
manaflow-ai/cmux#28422 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno