Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Invalidate CADisplayLink #3448

Merged
merged 1 commit into from
Jan 8, 2016
Merged

Invalidate CADisplayLink #3448

merged 1 commit into from
Jan 8, 2016

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Jan 6, 2016

CADisplayLink holds a strong reference to its target, forming a cycle that must be broken with -[CADisplayLink invalidate] when the animation is complete. I don’t yet have enough faith that MapChangeRegionWillChangeAnimated and MapChangeRegionDidChangeAnimated notifications are always coming from mbgl in pairs, so this change limits CADisplayLink to when MGLMapView is in the view hierarchy. It also pauses the CADisplayLink when the application is in the background. Finally, -[MGLMapView invalidate] has been renamed because that term tends not to mean “redraw” in Cocoa but is rather tied to timers.

Fixes #3130, which is a regression introduced in #2922.

@adam-mapbox @tomtaylor, can you verify that the original fix has not regressed with this change?

@1ec5 1ec5 added bug iOS Mapbox Maps SDK for iOS performance Speed, stability, CPU usage, memory usage, or power usage labels Jan 6, 2016
@1ec5 1ec5 self-assigned this Jan 6, 2016
@1ec5 1ec5 added this to the ios-v3.1.0 milestone Jan 6, 2016
This was referenced Jan 6, 2016
@1ec5 1ec5 force-pushed the 1ec5-unlink-display-3130 branch from f8916c4 to f35db42 Compare January 7, 2016 08:08
CADisplayLink holds a strong reference to its target, forming a cycle that must be broken with -[CADisplayLink invalidate] when the animation is complete. I don’t yet have enough faith that will-change and did-change notifications are always coming from mbgl in pairs, so this change limits CADisplayLink to when MGLMapView is in the view hierarchy. It also pauses the CADisplayLink when the view is hidden or the application is in the background. Finally, -[MGLMapView invalidate] has been renamed because that term tends not to mean “redraw” in Cocoa but is rather tied to timers.

Fixes #3130.

[ios] Also invalidate CADisplayLink on removal from window

[ios] Also shut down CADisplayLink when view is hidden
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug iOS Mapbox Maps SDK for iOS performance Speed, stability, CPU usage, memory usage, or power usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory leak with V3.0.0 iOS SDK
1 participant