-
Notifications
You must be signed in to change notification settings - Fork 9
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
thorvg: terminate engine properly. #101
Conversation
|
ThorVG requires the engine's initialization and termination functions to be called in pairs. + clear will be conducted by the thorvg internally when it's terminated.
78c4066
to
a383cc0
Compare
Please verify the build your side. |
@@ -154,8 +156,8 @@ impl Canvas { | |||
impl Drop for Canvas { | |||
fn drop(&mut self) { | |||
unsafe { | |||
tvg_canvas_clear(self.raw_canvas, true); | |||
tvg_canvas_destroy(self.raw_canvas); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would tvg_canvas_destroy
free the pushed paints from memory ? or do we still to manually free it in this case ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, if the canvas retains the paints, it will delete them.
@samuelOsborne, can you help test whether the dotlottie-ios mem leak issue has been resolved with this change ? |
@theashraf Theres been a reduction in the size of the leak which is great 🚀 theres still a small one of 160 bytes that seems to happen only happen once randomly when removing / remaking the dotLottie player that I can't track down it may be :
|
@samuelOsborne, thanks, could you address the actual ThorVG API call sequence that leads to memory leaks? |
@hermet there's a concern with our setup in the LottieRenderer struct. Right now, when we instantiate a new LottieRenderer, it creates ThorVG Picture and Shape objects. The problem is, we don't push these to the canvas straight away. so, when we load new animation data, the objects we made earlier aren't cleared out. @samuelOsborne That's explain why the memory leak is detected on the first run of the player. I'm thinking this issue might be better handled in a separate PR. It looks like it could touch a lot of areas because we might need to change when we create the Picture and Shape to only do it when we actually load an animation. This would mean checking in all our functions if these objects exist before we do anything with them. |
ThorVG requires the engine's initialization and
termination functions to be called in pairs.
internally when it's terminated.