-
-
Notifications
You must be signed in to change notification settings - Fork 829
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 in main library due to event listeners #353
Comments
Thanks! I've inspected the pull request. You can't destroy the painter process as you could have multiple active FilePond instances bound to the same painter (also the paint loop is shared with Doka to group read/writes) |
Great job! plus you also took care of dropLabel, awesome! the painter object is fine both ways for me, and the memory is not leaked anymore, so problem solved. By the way, what memor profiler are you using? I don't recognize it in the screenshot above. |
@LazaroOnline Fantastic! This is the Chrome dev tools performance tab. |
Summary
Memory is not being released properly after the "destroy()" method of filePond.
How to reproduce
https://codesandbox.io/embed/frosty-sea-1u5sm
https://1u5sm.csb.app/
Create and destroy instances of FilePond, every time it is destroyed with the method "destroy()" it is not releasing the memory properly. You can profile it with Chrome's devTools using the "Memory" tab, using the "Allocation instrumentation on timeline" option recording while creating/destroying instances, in a playground if you see the memory allocation charts shows the bars still in blue after destroying the filePond instance indicating that the memory is not being garbage collected.
All event listeners should be removed during the execution of the destroy method.
Tested using plain vanilla flavour js with FilePond.js and no plugins (no vue/react/angular...).
There might be more leaks in the plugins and adapters.
Expected behaviour
In above's code sandbox, after clicking in "Toggle Filepond uploader" multiple times, the filepond objects should not have remaining references (especially the event listeners as a common cause), so when the garbage collection occurs, the blue bars become white in Chrome's devTools indicating proper memory disposal.
Additional information
To solve this please accept the following pull request:
#352
That should fix some memory leaks.
Thank you.
The text was updated successfully, but these errors were encountered: