THREE.MeshLine icon indicating copy to clipboard operation
THREE.MeshLine copied to clipboard

Memory leak - maybe?

Open supermoos opened this issue 9 years ago • 6 comments

First of all, great job, it's a lovely addition to Three.js!

I'm not completely sure, but I think there may be a memory leak somewhere, I tested your spinner demo (basically holding down the mouse and releasing again after a few minutes), in Chrome the memory consumption just goes up and up, and never down again. On another project I'm working on this get's much more apparent since I'm updating the THREE.MeshLine geometry on every frame with the THREE.MeshLine.setGeometry() function.

Please see the attached screenshot for a memory profile, looks like it may have something to do with the WebGLBuffer objects?

Correct me if I'm wrong, just wanted to let you know as I guess you can figure whether there's any hold in this theory pretty fast :-)

screen shot 2016-01-04 at 16 15 02

supermoos avatar Jan 04 '16 15:01 supermoos

It's very possible there's a memory leak. Reusing properly the buffers is in the TODO list. I have to take a closer look at it, and how to dispose of buffers in threejs

spite avatar Jan 04 '16 22:01 spite

Okay, sure thing :-)

supermoos avatar Jan 05 '16 08:01 supermoos

fixed in #15

jeremyabel avatar Mar 20 '16 21:03 jeremyabel

This fix is not working

qvantor avatar Apr 08 '16 09:04 qvantor

it doesn't work if count of points in position array changed

ihor-zhakun avatar Jul 08 '16 15:07 ihor-zhakun

Found a memory leak and fixed it in https://github.com/spite/THREE.MeshLine/pull/25/commits/f6c9ba00a1f59d299d12506b9365a1f87525fc78

Basically the this.counters array was getting pushed values every time setGeometry() is called but was never cleared, so it would just keep growing.

Fixed by this.counters = [] at the begining of setGeometry()

Jared-Sprague avatar Oct 06 '16 02:10 Jared-Sprague