LottieFiles / dotlottie-ios

.lottie player for iOS
MIT License
44 stars 6 forks source link

Crash issue: It is presumed to be a crash due to memory shortage. #40

Open eunryu93 opened 2 weeks ago

eunryu93 commented 2 weeks ago

Hello,

I am creating an issue regarding a crash that was identified while using this library.

We have noticed a sudden spike in memory usage while using this library. (We are using it to generate a loading bar, and each time the loading bar is created, we observed a sharp increase in memory usage.)

While preparing to launch the app, our QA team reported crashes during testing. Upon investigation, we found that this issue frequently occurs on low-spec devices. When debugging with Xcode, we received an alert indicating a crash due to memory shortage. On devices with lower memory capacity, we also noticed that the devices get quite hot, and both CPU and memory usage spike. Upon further investigation using Instruments, we confirmed that the player object is not being released after being created, leading to multiple instances being generated.

This crash is also occurring in the live app, and we have attached logs obtained via Firebase Crashlytics. Although we have also included screenshots, it has been confirmed that the crash is happening in DotLottieAnimationView.swift, specifically at line 31 in Coordinator.swift related to mtkView. The error occurs intermittently, 3-4 times a week, but is consistently being reported. It affects various devices, primarily older models. This issue has been consistently occurring since we switched from the Lottie library to the DotLottie library.

We have since updated the app version, reverting to using the Lottie library to handle dotLottie files, and we are monitoring the situation. If the issue no longer occurs, we assume it is indeed related to the DotLottie library.

Here are the steps I have tried:

Created the DotLottie model and attempted to release it from memory by setting it to nil, followed by setting the loading view to nil: it still was not released from memory. Modified the logic to prevent the creation of a new DotLottie object if one already exists: this had no effect. Implemented a singleton pattern and added safeguards to avoid multiple object creations: the crash persisted despite this. Could you please let me know if there is a possible solution to this issue? I would greatly appreciate it if you could look into this matter and provide any suggestions for resolving it.

Attach ScreenShot:

스크린샷 2024-09-27 11 26 19
samuelOsborne commented 2 weeks ago

hello @eunryu93 Thank you for your detailed ticket. It is an issue we've identified within the core player, written in rust, we have a PR open for it here: https://github.com/LottieFiles/dotlottie-rs/pull/102

I'll look in to this again and try and get it completed and brought in to this repo.

Thanks

eunryu93 commented 2 weeks ago

@samuelOsborne Oh, I see. Thank you for your answer. If you don't mind, I'd like to contribute to the issue as well. Would that be okay?

samuelOsborne commented 1 week ago

of course @eunryu93 :))