-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory Leak on iOS: FastImage not released from memory when callbacks onLoad is set #398
Conversation
I seem to be getting two compile errors in XCode when running these changes:
__weak typeof(self) *weakSelf = self;
[weakSelf sendOnLoad:image]; |
@adammcarth Okay I will have a look at it. Sound weird tho, you are not supposed to pass a strong pointer into a block. |
Hello @adammcarth I have the same problem trying to applying the fix. Thank you, |
I have tried also to change from |
c760503
to
8d258d5
Compare
Yeah sorry guys my bad, the correct syntax is But still this fix isn't enough to fix the memory leaks. |
…tImageView as it is the native side that will call the callback and not the js side
Well okay I am stupid, I have been chasing a ghost 😓 Actually if you implement I was trying to retrieve Well at least I have discovered that you can't retrieve a parameter that doesn't exist from a callback. Anyway we still need to give a weak pointer of self to the completion block of SDWebImage. |
Hello, @StevenMasini and thank you. Also changing from RTCBubblingEventBlock to RTCDirectEventBlock fixes the fact of the parameters to the callback which may generate memory leaks? Thank you, |
I am preparing another Pull Request with more fixes. I am closing this Pull Request as the new Pull Request will contain these fixes and more. |
Changelog
Solution to the open issue #371
weak
reference toself
to callsendOnLoad
in thesd_setImageWithPreviousCachedImageWithURL:placeholderImage:options:progress:completed:
Holding a
strong
reference toself
in a block can lead to memory leaks as the block will hold the reference until it is called.Always pass weak reference of self into block in ARC?