-
Notifications
You must be signed in to change notification settings - Fork 72
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
Gif memory leak #203
Comments
The memory will be released while the animation is being stopped. |
I just tried to use APNG and it seems that there is no memory leak anymore. Previously i tried WEBP and had the same problem. |
2023-09-09.12.18.09.mov |
Ok, we tried to detect this leak with your project and found that as below: |
Update to v2.28.0 will resolve this problem. |
expo/expo#24358 await the review and merge |
That was quick! Thanks a lot! Appreciate it! Somehow I missed the start call in the sources with the Animatable "if" block, was thinking about calling stop when they clear the view, but I had to do the if block there so the type would be Animatable to stop the animation too. But I guess the recycle method is a more bullet proof way here. |
By the way, can confirm |
New Issue Checklist
Issue Info
Issue Description and Steps
I was building an app with React Native and was using expo-image package, that uses Glide and this library to animate gifs. After some investigation, I realized that the only thing causing my memory leaks was this library. Commenting out this library implementation in Gradle solves all the memory leaks.
The expo-image package uses pretty much the same code as another library called react-native-fast-image that also uses glide, but the only difference between both of them is the usage of this library - the fast-image one animates gifs using glide, but the performance of it is not great by any means.
Taking a heap dump I saw that byte[] are never released from the memory, and it happens only with this library enabled.
They do clear the view the normal way you would do with glide: https://github.com/expo/expo/blob/main/packages/expo-image/android/src/main/java/expo/modules/image/ExpoImageViewWrapper.kt#L423-L429
After a quick investigation of the code, should this method be implemented somehow?
https://github.com/penfeizhou/APNG4Android/blob/master/plugin_glide/src/main/java/com/github/penfeizhou/animation/glide/FrameDrawableTranscoder.java#L101
Here is the original issue: expo/expo#24259
Here is the gradle file: https://github.com/expo/expo/blob/main/packages/expo-image/android/build.gradle#L103
The text was updated successfully, but these errors were encountered: