PBRMetallicRoughness Memory Leak

Hi,

Re-produced in the playground: https://playground.babylonjs.com/#0X0BCP

Demonstrating a memory leak in node material that uses PBRMetallicRoughness. Leave it running foreground for like 30minutes or more and you’ll see in your browser’s inspector that the memory usage keeps going up slowly and never stops. It starts from 30mb and goes slowly way over 100mb. It’s much worse in our actual application with more complex scene and we run out of memory pretty quickly when using PBRMetallicRoughness :frowning_face:.

Tested with Chromium based Edge Version 86.0.622.51 (Official build) (64-bit) and Chrome Version 88.0.4302.0 (Official Build) dev (64-bit).

I also tested with the latest version of Babylon.js v4.2.0-beta.20. Same result.

Thanks.

Thanks for the report, there’s a memory leak indeed, this will be fixed by: