How can i check if dispose removed my geometries and materials?

I have a function:

 function removeBySid(sid) {
            scene.traverse(function(node) {
                         if (node instanceof THREE.Mesh) {
                            if (node.geometry) {
                                node.geometry.dispose();
                            }
                            if (node.material) {
                                node.material.dispose(); 
                            }
                         }

                        scene.remove(node);
            });
        };

how will i be able to tell if geometries and materials have been disposed? is there a way to check?

Hello s333,

If you are using three.js webGLRenderer, there is a .info property that should give the info you are looking for:

memory:

  • geometries
  • textures

render:

  • calls
  • vertices
  • faces
  • points

programs

I use to integrate threex.rendererstats from learningthreejs.com, which encapsulate the .info details into a little app. Unfortunatly, the app stopped working a few version back. Maybe someone could refresh the code as it gives very usefull details, specially when one starts looking a memory/perf management…

Another option would be to use the shader editor from firefox dev edition that gives the loaded/unloaded programs.

GL & HF

1 Like

Thanks! awesome! :slight_smile: