According to the first pic (for the 1st model), the render.info.memory.geometries = 15
But when I load the 2nd model (the second pic), the render.info.memory.geometries = 32
Actually the 2nd model only has 17 geometries and the 1st model has 15 geometries.
Here is how I use to dispose all the things:
// Clean up mesh.children.forEach(child => { child.traverse(function(obj) { if (obj.type === 'Mesh') { obj.geometry.dispose(); obj.material.dispose(); obj.texture.dispose(); } }) });
Are you seeing any errors in your JS console? I would expect that code to throw an error; obj.texture is not a property. You may also want to check obj.isMesh instead of obj.type === 'Mesh', in case your file has a SkinnedMesh in it.
I didn’t see any error in the console.
But you’re right, I should check obj.isMesh() instead.
Maybe this makes me cannot free up the renderer memory? Since when I check the renderer.info whenever I change another models, the renderer memory increased continuously.
(You can see the pics I uploaded above).
Sorry, I’m not able to debug from these pictures. The code above would throw an error if it were running, and that error would appear in the console. If there is no error shown and the code is not running, then there seems to be some mistake elsewhere in your demo.
I’m seeing similar increase of renderer.memory.textures which I reported here.
I placed an example in jsfiddle (plays in Chrome).
I don’t know if this is a problem though.