Memory leaks due to unsafe swizzling? #11
Comments
Swizzling doesn't cause leaks. It's not magic. JRSwizzle isn't doing anything differently than what's being used here (the real utility of that library is providing consistent support across versions of the Objective-C runtime). Notice also that the leaked bytes correspond to a stack trace for creating PNG images ( Whatever the problem is, I don't see any evidence that it's caused by AnimatedGIFImageSerialization. The only reason it's in the stack trace at all is that it swizzled the implementation of |
Ok, I trust you. But still, isn't it weird that these leaks go away when I replace swizzling by JRSwizzle on AnimatedGIFImageSerialization? Maybe it's just an Instruments bug. |
I'm seeing the same thing as @rsanchezsaez. Every image is leaked unless I switch to jr_swizzleMethod. I have an image-intensive app, and the OOM-killer says it's so in addition to Instruments. |
I have the same issue - imageWithData = leaks, UIImageWithAnimatedGIFData no leaks. |
@rsanchezsaez @bwhiteley it seems that the reason why JRSwizzle helped is that you're using it wrong.
The whole thing works because Still weird why it leaks 😓 |
Still getting huge leaks, every image is leaked. When I remove the library, no leaks. |
I switched pull to refresh control (UzysAnimatedGifPullToRefresh) to use YYImage for gifs |
@dmitry-ivanov-rlt Hi Dmitry, thanks for the advice, will try think about switch. Unfortunately I need to enable saving GIF to a file and downloading it via AFNetworking (probably i can change the usage to get NSData instead of UIImage) |
Hi,
Under some circumstances, Xcode's Memory Leaks Instrument seems to report leaks when using AnimatedGIFImageSerialization in combination with Crashlytics. I don't know if those are actual leaks or not. All of these have in common Crashlytics and AnimatedGIFImageSerialization:
The leaks seem to go away if you replace AnimatedGIFImageSerialization's swizzling by JRSwizzle, which seems to be safer for subclassing and inheritance:
The text was updated successfully, but these errors were encountered: