-
Notifications
You must be signed in to change notification settings - Fork 12
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 issues if animation is loaded and destroyed several times. #1
Comments
I have decreased some of leaks by adding to LottieAnimation.qml the following lines:
|
Good suggestion! There's a
Feel free to submit a pull request |
Calling "destroyAnimation" causes error for my code because of "canvas.clear" call. |
Hello all, I have noticed the missing call to the Lottie.destroy function as well. I think I found another leak source ..... pun intended ;-) In lottie_shim.js we are loading the lottie.js lib with Qt.include(): Qt.include does copy the whole javascript file into the namespace of the including object. I have tried to reproduce the issue again in the repo: I have added a new Component in main.qml which just displays a blue rectangle (it does not load Lottie) The situation of loading the lib with Qt.include() has been duplicated in script.js: a) Load factorial.js in the function showCalculations(value) In case of situation a) the code is leaking memory (check with QmlProfiler) I have tried to apply version b) to lottie-qml, but without success. I do not really understand the window and document Thanks for your help and best regards, |
@ThomasVogelpohl I also have refactor this thing but not because of leak but because of annoying reparsing js code when load/unload different qmls with LottieAnimation. It leads to performace problems. |
I don't have much time to investigate or look into any of this, feel free to submit a merge request and I'll review there, all of your explanations and code snippets do look sane. |
@kbroulik no problem. I also have no time to make a request because my changes breaks lottie.min.js so you can't update it easily. Writing here just to help if someone have the same issues. Also, about leaks. I figured out what with the last qt framework version I almost have no leaks for my files attched above (not tested a lot, but much better than previous versions). |
Btw, eventually this module would be obsolete as Qt has an implementation on their own. It's still software-rendered but using QPainter and C++ code rather than a Canvas with JavaScript logic. I haven't tried it myself yet: https://code.qt.io/cgit/qt/qtlottie.git/ |
@kbroulik I have tested Lottie with the qtlottie Repo and some animations are working and some are not. It is a mixed bag, as expected for an early Beta release. |
Thanks, I also tested and this is not quite working for my animations. But hope this will be fixed soon! |
@kbroulik I tried the new Qt Lottie Animation and it still doesn't work for my animations. So give this a try. |
Hi kbroulik,
at first thank you for your Lottie QML wrapper, it really works quite well.
Unfortunately, I do have issues with increasing memory demand. If I monitor the memory demand with the QML Profiler, the demand for memory is increasing each time I load a Animation JSON file.
This is a screenshot from the QML Profiler:
https://github.com/ThomasVogelpohl/lottie-qml/blob/master/screenshots/Screenshot%202019-02-06%20at%2021.17.16.png
I have tried calling the destroy() functions for the JavaScript lib, but it does not seem to make any difference.
I have forked your Repo and added a few files to be able to easily demonstrate the problem:
https://github.com/ThomasVogelpohl/lottie-qml/commits/master
The code will load and unload a Lottie Animation 10 times.
You see that the memory bars are steadily increasing.
So you have any suggestion on what to try to release the memory ?
Thanks,
Thomas
The text was updated successfully, but these errors were encountered: