konvajs / konva

Konva.js is an HTML5 Canvas JavaScript framework that extends the 2d context by enabling canvas interactivity for desktop and mobile applications.
http://konvajs.org/
Other
11.59k stars 926 forks source link

Layer.get('Shape').destroy() memory leak #207

Closed jaymainal closed 7 years ago

jaymainal commented 7 years ago

I had a Layer with some Rectangles and Circles.

I will update the layer periodically. (Remove all Rectangles and Circles and then add them). (Due to these Rectangles and Circles maybe different)

I use Layer.get('Rect').remove() or Layer.get('Rect').destroy()

But it seems not really release even wait a long time.

Please reference below pictures.

img1

img2

And what is the Konva.Transform, it also increase by time.

Finally cause memory leak.

Thanks your help

lavrton commented 7 years ago

I guess you just don't need to use remove() method. Take a look here: http://konvajs.github.io/docs/performance/Avoid_Memory_Leaks.html Reopen if you still have issues.

jaymainal commented 7 years ago

Thanks, u are right, directly use destroy works well