-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
Milestone
Description
New Issue Checklist
- I have read and understood the CONTRIBUTING guide
- I have read the Documentation
- I have searched for a similar issue in the project and found none
Issue Info
Info | Value |
---|---|
Platform Name | macos |
Platform Version | 15.1.1 |
SDWebImage Version | 5.20.0 |
Integration Method | SPM |
Xcode Version | 16.2 |
Repro rate | 100% |
Repro with our demo prj | n/a |
Demo project link | n/a |
Issue Description and Steps
When an SDAnimatedImagePlayer
creates a SDDisplayLink
in -[SDAnimatedImagePlayer displayLink]
the SDDisplayLink
is not released when the SDAnimatedImagePlayer
is deallocated. This results in a proliferation of CVDisplayLink
threads.
The current implementation of '-[SDAnimatedImagePlayer dealloc]' is:
- (void)dealloc {
// Dereference the frame pool, when zero the frame pool for provider will dealloc
[SDImageFramePool unregisterProvider:self.animatedProvider];
}
And I se nothing that would suggest that the SDDisplayLink
is stopped or removed from the RunLoop. When I change the code to something link:
- (void)dealloc {
// Dereference the frame pool, when zero the frame pool for provider will dealloc
[SDImageFramePool unregisterProvider:self.animatedProvider];
[_displayLink stop];
[_displayLink removeFromRunLoop:[NSRunLoop mainRunLoop] forMode:_runLoopMode];
}
Then I no longer see a proliferation of CVDisplayLink
threads (as seen in Xcode):
It is unclear if this is the correct solution to prevent the leak or if a better solution is available.