New Issue Checklist
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.
New Issue Checklist
Issue Info
Issue Description and Steps
When an
SDAnimatedImagePlayercreates aSDDisplayLinkin-[SDAnimatedImagePlayer displayLink]theSDDisplayLinkis not released when theSDAnimatedImagePlayeris deallocated. This results in a proliferation ofCVDisplayLinkthreads.The current implementation of '-[SDAnimatedImagePlayer dealloc]' is:
And I se nothing that would suggest that the
SDDisplayLinkis stopped or removed from the RunLoop. When I change the code to something link:Then I no longer see a proliferation of

CVDisplayLinkthreads (as seen in Xcode):It is unclear if this is the correct solution to prevent the leak or if a better solution is available.