This is expected as we store shaders (effects) so we do not need to recompile a shader twice (as compilation is quite slow).
That being said if you do not want to waste memory for that, you can just call this:
Our actual use case is closer to this, in which we’re loading a Node Material once and then cloning so we can use it in different ways across meshes. Even with this update, I’m still seeing memory leaking.
You know what? I forgot I did ref counting for effects lol.
We are even letting one frame to make sure you are not recreating the same shader before disposing the compiledEffect.