GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.36k stars 4.05k forks source link

editor.load possibly causes memory leak #2403

Closed varadero closed 3 years ago

varadero commented 4 years ago

How to reproduce:

What happens: The memory is constantly increasing. If you open Chrome's "Performance monitor" you can also see "DOM nodes" and "JS event listeners" constantly increasing. After about 3 minutes "JS Heap size" increases from 24MB to 1000MB, "JS event listeners" increases from about 1600 to 50000+, "DOM nodes" from 8600 to 100000+. After some time the browser tab will crash because of the high memory consumption.

The same happens also if you have very simple grapesjs project and place a single block in the canvas and start in an interval a call to editor.load().

varadero commented 4 years ago

This is important. If not fixed, it makes GrapesJS dangerous to use especially in SPA applications.

artf commented 4 years ago

I'll check it out, but any help is welcome

diazemiliano commented 4 years ago

I'm having the same issue here. Even after destroy the editor, the issue remains.

Nelida27 commented 3 years ago

Hello @varadero @artf , Any update about this issue, since I have the same problem.

artf commented 3 years ago

Not really, I've refactored a lot of modules since this issue by taking into account the memory leak problem but was not really focused on inspecting each module so, I guess the issue is still here. I'm closing this one in favor of #1470, probably I'll be back on this issue soon and will report any possible update there.

samehdoush commented 1 year ago

I'm having the same issue here. Even after destroy the editor, the issue remains.

zhixXiang commented 1 year ago

I'm having the same issue here. Everytime load increase the memory

zhixXiang commented 1 year ago

@artf I use below code on server side let editor: Editor | null = grapesjs.init({ headless: true }); editor.loadProjectData(myJson);

this cause memory leak Everytime loadProjectData increase the memory, my server out of memory soon.