paperjs / paper.js

The Swiss Army Knife of Vector Graphics Scripting – Scriptographer ported to JavaScript and the browser, using HTML5 Canvas. Created by @lehni & @puckey
http://paperjs.org
Other
14.5k stars 1.23k forks source link

Memory leak problems #1856

Open haruband opened 4 years ago

haruband commented 4 years ago

I encountered a huge memory leak problem on paper.js with react.js. After unmounting the react component which uses paper.js, the huge memory isn't freed. I checked the memory leak through chrome inspector. I did call paper.remove(), paper.clear(), and others on unmount, but it's not resolved. Do i miss something? I need your advice.

sasensi commented 4 years ago

Hi, could you provide us a way to reproduce the issue so that we can see what's happening ?
Also could you tell us more about the conditions under which this is happening (OS, browser...) ?

essawy99 commented 3 years ago

I can second this issue. paper.remove() does not completely remove the object from the heap. You can go on chrome and do a heap snapshot and see it get bigger no matter how much .remove() is called. I can give you a program of code that recreates the issue but it is a pretty large program that you probobly wouldn't want to sift through. I imagine if you create a number of moving objects each frame and remove them after 1000 frames or something you will see the issue.

viniciusdeliz commented 2 years ago

@essawy99 @haruband any way to improve this issue?

essawy99 commented 2 years ago

@viniciusdeliz I spent a little bit of time trying to track down the issue last year and there seems to be a couple arrays that grow as objects are created but objects are not removed when .remove()is called. You would probably need to track down as many of these as you can and delete objects from them when .remove() is called

Yc-Chen commented 1 year ago

Hi, we hit the issue of memory leak as well. I wonder what's the status of this issue? I'm happy to contribute.

noah-moutfitters commented 8 months ago

+1, any updates on this?