Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Three.js - release memory

I use the built-in shape extrusion function to extrude a shape along a spline. I create a new mesh everytime I move the nodes of the spline. But this way my RAM is full very fast. Everytime I create a new mesh I delete the old one with

scene.__removeObject(mesh); 

but it doesn't release the used memory. I tested Firefox Nightly and Chrome and both crash if the memory is full.

I searched for a general WebGL feature and for Three.js related solution but didn't find anything.

Maybe someone with more WebGL / Three.js knowledge can give me a hint. Thank you

like image 525
user1366812 Avatar asked Apr 30 '12 23:04

user1366812


1 Answers

Ensure you're not referencing the javascript mesh object anywhere else, so that the garbage collector can delete it.

like image 57
sole Avatar answered Oct 18 '22 05:10

sole