-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
iOS 11 FLAnimatedImage object leak. Bug #2377
Comments
The But, I'm confused that since we already add a I think something we done for FLAnimatedImage enhancemence is wrong. So I'll revert some change and provide a advanced control for each of thing we done, but not just hide all the detail behind. |
@dreampiggy I disabled the weak memory cache on the didFinish call in Appdelegate but this did not seem to fix the crash. One thing that might be creating problems is that the system memory warning never actually gets triggered. I updated my test project if you want to take a look. |
@dreampiggy , these weak reference fix some problems. |
@zhongwuzw I guess that And also, if you don't disable The insteresting behavior is that |
@zhongwuzw Setting the maxMemoryCountLimit actually works, but also limits the cache for regular images. I would prefer if I relied on the actual memory warnings for purge caching instead. If we find no solution I will probably go with your suggestion, too many crashes in production from this. |
@dreampiggy Yeah, it's not retain cycle. Just would leads some extra objects alive and increase the memory. |
@zhongwuzw are you using my test project? @dreampiggy have you been able to replicate from the issue? My memory increases to between 500m - 2.x G before the crash with an iPhone X. I just check forcing memory warnings and they work fine. Memory deallocates properly. I think the system for some reason doens't automatically trigger them, |
@papanton Yeah, I use your prj to debug.
@dreampiggy , memory warning is not always triggered even the memory is going to be exhausted. Jetsam would kill any not good memory citizen.
I don't know wether we can add the functionality to monitor memory consume. The benefit is we can manually remove the cached objects in low memory to prevent crash. The penalty is it would leads to occupy more CPU and battery energy. @dreampiggy What do you think? 🤔 |
@zhongwuzw I would not rely on |
@papanton Sorry maybe I miss this issue. The demo you provide seems not works because of that API failed in this url : {"message":"Unauthenticated."} |
@dreampiggy opened up that endpoint, the project should work now. I apologize for that. |
@papanton I try the demo. With both iOS 10.3 && iOS 11.2 real device, it can trigger a OOM crash after many GIF images was shown. No difference between iOS 10 && iOS 11. It seems that And another interestring issue, related to #2226 . In iOS 11.2~11.4, Apple introduce a bug that will cause crash because of decoding failed during Core Animation commit render. See #2226 and my bug report for Apple. During my test, I found that my iOS real device running iOS 11.2 will get this crash before the OOM crash or memory warning notification. So I guess maybe related to the difference between iOS 11 & iOS 10. Good news, this crash have already been fixed in iOS 12. (But Apple seems not fix this in iOS 11.4 :)) The better solution, maybe it's to limit the memory cache's size. You can try set In #2374, I'll try to provide more detail control about limit the memory usage. For example, you can disable store the |
@papanton 4.4.2 is out. Could you please read me reply above (I analysis the reason and provide some help), and try the new version ? To summary, you can disable the If you don't mind a short-term empty image during cell reusing, you can call If you still want to keep high frame rate without flashing, you'd better keep use cache, but you'd limit the cache size by |
Hey @dreampiggy thanks for all the help, I ended up setting the maxmemory cost and it seems to be performing well. You can close this issue. |
@papanton The animated image is a big task to talk about. If you're still care about the animated image solution , you can consider to try Animated Image in 5.0.0-beta. Which will not contains this issue because the we don't need to query disk cache during image display timing. |
New Issue Checklist
Issue Info
Memory grows uncontrollably during gif loading. Eventually, the app crashes due to memory issues. Memory warning never triggered. Demo project provided, hooked up to a source of gifs. Scroll on iOS 11 Device real device and it should crash. This issue occurs on iOS 11 Devices but not on iOS 10. On an old iPhone 5 running iOS 10 that I have, there are no issues.
After a bit of poking around with instruments, I realized there is a FLAnimatedImage leak. FLAnimatedImages are initialized but not deallocated.
Please advice, or let me know if you have any further questions.
This is instruments for iOS 10. See how the memory is getting deallocated:
This is ios 11 iPhone X. See how FLAnimatedImage has not been deallocating. App Crashed.
The text was updated successfully, but these errors were encountered: