grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

[Question] Possible memory leaks

Open mgotovkin-plana opened this issue 6 years ago • 8 comments

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 image So,

  1. Why not using native bind and other functions?
  2. 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

mgotovkin-plana avatar Sep 28 '18 13:09 mgotovkin-plana

@BrainMaxxx would be glad to have a help on this :)

artf avatar Oct 02 '18 21:10 artf

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.

forssri avatar Nov 12 '19 09:11 forssri

Another possible memory leak caused by editor.load() is described in https://github.com/artf/grapesjs/issues/2403

varadero avatar Nov 12 '19 21:11 varadero

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.

simplecommerce avatar Dec 30 '19 21:12 simplecommerce

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

artf avatar Jan 02 '20 16:01 artf

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...)

artf avatar Mar 03 '20 22:03 artf

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 avatar Apr 07 '20 15:04 0000marcell

@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

artf avatar Apr 16 '20 00:04 artf

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 avatar Jan 05 '23 04:01 bryanjamesmiller

@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.

artf avatar Jan 06 '23 09:01 artf