-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 using goToAndStop and destroy #1159
Comments
Hi, can you share a link with an example or the animations you're loading so I can reproduce the case? |
@bodymovin I sent you email with link and video with steps to reproduce |
Any solution? I have the same problem. I am adding an animation and destroying after 3 seconds but some garbage is not being collected because each time I fire a new animation my app will being slow, unfeasible, until Chrome tab gets completely frozen. |
hi @luizgamabh |
Solution was to always clone original animation data object, what will prevent it from polluting and memory leak. So I used |
I'm also using the same animation for multiple elements, but they are not fired in parallel. I have a timeline and when somebody likes a feed item, I create a new element on the fly: Something like:
|
Try to clone always |
This fix improved overall performance but my angular page with animations is still freezing for some time due to long rendering and animation destroying. I guess OffscreenCanvas feature #1212 can solve that problem |
My animation json is cached at starting phase of my app, so I never read it again, but I use the same one. |
Your cached animation JSON can be mutated by Lottie, so try to clone deeply it every time you create a new animation |
Oh, I see. Thank you Jokero. It solved my problem. |
Sorry to necro this issue, but wow it's wild that Lottie mutates Deep cloning the |
To avoid memory leak airbnb#1159 airbnb#2151
To avoid memory leak airbnb#1159 airbnb#2151
Tell us about your environment
Browser and Browser Version:
Chrome 66.0.3359.181
After Effects Version:
Last version
I have a page in an angular application with around 20 animations rendered by
SVGRenderer
. And I'm usinggoToAndStop
for displaying specific frame of animations (like preview of an animation).When I leave that page, I'm calling
destroy
method for every animation, so all resources should be freed up. But then I'm opening the page with animations several times, at some time the whole page freezes and becomes unresponsive (actually it's always 4th time). The page memory consumption is increasing very fast. In that case I only can kill the page in process manager.First finding was the typo in property name (https://github.com/airbnb/lottie-web/blob/master/player/js/elements/svgElements/SVGShapeElement.js#L303):
But it didn't help unfortunately. Then I added breakpoint here https://github.com/airbnb/lottie-web/blob/master/player/js/elements/ShapeElement.js#L24 and saw that number of shapes on every page opening dramatically increases:
Looks like not all resources are freed up after animation desctruction and search through shapes is broken.
Hope it will give you some insight into the issue
The text was updated successfully, but these errors were encountered: