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

fix: 🐛 segmentation fault when LottieRender is dropped #91

Merged
merged 2 commits into from
Mar 4, 2024

Conversation

theashraf
Copy link
Member

@theashraf theashraf commented Mar 3, 2024

issue
When the DotLottiePlayer instance is dropped from memory and a new instance is created, there is a rapid increase in memory usage, resulting in a memory leak.

Solution
Calling tvg_canvas_clear(true) should remove the paints instances from memory. Therefore, all that needs to be done is to invoke tvg_animation_del when the Animation instance is released.
Also ensure that tvg_canvas_clear(true) followed by tvg_canvas_destroy is called to drop the canvas properly. This will ensure that the Animation, Canvas, and any paints pushed to the canvas, such as Picture and Background shape, are completely freed from memory, and we don't have to drop them individually.

Copy link

changeset-bot bot commented Mar 3, 2024

⚠️ No Changeset found

Latest commit: 032d296

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@theashraf theashraf marked this pull request as ready for review March 4, 2024 05:09
@samuelOsborne
Copy link
Member

@theashraf Works well :-)

@theashraf theashraf merged commit ea44732 into main Mar 4, 2024
1 check passed
@theashraf theashraf deleted the fix/segmentation-fault branch March 4, 2024 14:11
@github-actions github-actions bot mentioned this pull request Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants