My application is loading a large number of meshes. When I try to dispose of old meshes to free up memory, it seems the memory is not actually being released. Am I missing something?
Here is a simple example to reproduce the issue:
- Load 100 large binary meshes
- Dispose of all the meshes
After disposal, Chrome task manager shows that 250mb of memory is still being used, the same as before step 2.
memtest
var scene = new THREE.Scene(); var mymesh=Array(); // 1. Load a lot of geometry/meshes... for(var i=0;i<100;i++) { var bloader; bloader = new THREE.BinaryLoader(); bloader.load( "objekte/presto_6.js" , function( geometry ) { mymesh.push(new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( {color:0xffffff } ) )); scene.add(mymesh.length-1); }); } // 2. Try to dispose objects and free memory... for(var j=0;j<mymesh.length;j++) { mymesh[j].geometry.dispose(); mymesh[j].material.dispose(); screne.remove(mymesh[j]); } mymesh=Array(); </script>