I am facing an issue with managing memory in my large scene that consists of Mesh and MorphAnimMesh objects. I have tried to free up memory by removing these meshes, but it seems like the memory usage remains unchanged.
for ( var i = scene.children.length - 1; i >= 0 ; i -- ) {
var obj = scene.children[i];
scene.remove(obj);
obj.deallocate();
obj.geometry.deallocate();
obj.material.deallocate();
obj.material.map.deallocate();
}
Even after setting the object to null, there doesn't seem to be any decrease in memory usage. Google Chrome's memory snapshot shows the objects are still present, particularly mentioning morphTargets in THREE.Geometry @1862203.
I need to find a way to effectively remove objects from memory before transitioning between levels in my game, as the memory usage keeps increasing significantly after multiple level changes.
If anyone has any ideas on what I might be doing wrong or a better approach to manage memory in Three.js, please let me know.