You can traverse through the scene, remove all objects and dispose the respective geometries, material and textures. Example code for this looks like so:
Alright, the following is what I have so far, and I’m doing it to see if there’s any difference in memory use compared to not doing it (my guess is there won’t be and the Garbage Collector will work great, but just in case). Am I missing anything?
console.log('dispose renderer!')
renderer.dispose()
scene.traverse(object => {
if (!object.isMesh) return
console.log('dispose geometry!')
object.geometry.dispose()
if (object.material.isMaterial) {
cleanMaterial(object.material)
} else {
…