Should Mesh.dispose() call morphtargetmanager.dispose()?

When a mesh is disposed it’s not calling dispose on its morph target manager, and it holds ref to its bone texture.

I noticed repeatedly creating and destroying a mesh with bones that scene.textures.length would increase.

It’s expected, because a morph target manager can be shared by multiple meshes. So, it’s the user responsibility to dispose it when they know it is not (and won’t be) used anymore.

Oof… thanks for the answer, but what a gotcha. I think I’ve seen texture do some referencing counting that might be appropriate here, because as I haven’t seen anything that implies disposal is the user’s responsibility, and this situation leads to misuse.

Yes, reference counting would be a way to solve it for morph target manager, but it’s not implemented this way unfortunately, and it would be a breaking change to do so.