grapesjs
grapesjs copied to clipboard
[Question] Possible memory leaks
Hi, I am working on a project with Angular 6 and I am investigating a memory leak after destroying the editor on _previousAttributes and possibly coming from underscore bind function
So,
- Why not using native bind and other functions?
- I figure out that there are couple of underscore libraries inside grapes.js file 1.8.3 and 1.9.1, I guess caused by backbone-undo package, do you have any plans on fix this?
Thanks, Regards Max
@BrainMaxxx would be glad to have a help on this :)
This problem still exists, even after invoking the editor.destroy() method it is not freeing up the memory. In scenarios where multiple instances of grapesjs editors are used.
Another possible memory leak caused by editor.load()
is described in https://github.com/artf/grapesjs/issues/2403
Here is a small example to reproduce the issue I believe.
https://codesandbox.io/s/react-router-basic-49ki1
If you click Dashboard
, you will see the editor, if you click any other links and go back to the Dashboard
and take a look at the memory, it keeps going up and up, even if I use destroy in the unmounting of the dashboard component.
I apologize but this is not yet solved. I've discovered that after removing the component the reference to its DOM was still there. Unfortunately, removing the reference brokes the Sorter, so I have to figure out how to refactor it properly
Just a quick update, I'm working on this issue here, so far memory leaks with components seems to be fixed, now I'm trying to solve the one with destroying part (a bit longer as I have to isolate each module, a bit of mess in each of them...)
Hi @artf I'm block because of a problem that i think is related to this, if you select a element in the canvas then run editor.destroy() and resize the window, the whole application breaks because the listeners are not being removed, stopListening is being called, but aparently is not removing the window resize listener declared in 'view/SelectComponent' toggleSelectComponent, would love to help
@0000marcell in the next release, I'll probably include some fixes to avoid major memory leaks inside components but this issue is still far from being closed. For now, if you know exactly where the leak is, I'd be happy to merge a PR
Hi @artf any luck with memory leak fixes? Have any fixes been deployed, and if so can you point me to which versions of Grapes has the fixes? Thanks and happy new year!
@bryanjamesmiller I didn't check/notice new memory leaks in a while and the reported issue was fixed long time ago. I'd recommend using always the latest version which should be definitely more stable from that point of view.
If anybody is able to reproduce other related issues I'd suggest to open a new BUG issue with reproducible steps.