Skip to content
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

Correct the frequent GC issues caused by L.beginSection and L.endSection methods. #2493

Closed
uni-cstar opened this issue Apr 11, 2024 · 1 comment · Fixed by uni-cstar/lottie-android#1

Comments

@uni-cstar
Copy link
Contributor

Lottie is supported and developed on nights and weekends. Issues from Lottie sponsors will be prioritized.

Is your feature request related to a problem? Please describe.
The L.beginSection and L.endSection methods are used to record some trace information and are frequently called during the draw process. Although traceEnabled is by default false, L.beginSection and L.endSection methods do not perform any substantive logic. However, they generate a large number of strings at the method call sites, leading to frequent garbage collection issues (occurring continuously in a short period due to the excessively frequent invocation of draw).

Describe the solution you'd like
Provide the isTraceEnabled method in the L class to return the value of the traceEnabled variable. Before calling the L.beginSection and L.endSection methods, first check if isTraceEnabled is true. If not, do not invoke them.

Describe alternatives you've considered
You can use inline methods in Kotlin to handle calls to the trace method, but this change is quite significant and requires rewriting the source code in Kotlin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@uni-cstar and others