threejs / three-devtools

three.js devtools
https://chrome.google.com/webstore/detail/threejs-developer-tools/ebpnegggocnnhleeicgljbedjkganaek
MIT License
603 stars 79 forks source link

Tool leads to memory leakage #48

Closed kroko closed 4 years ago

kroko commented 4 years ago

Please see https://github.com/mrdoob/three.js/issues/18759#issuecomment-592223144

TL;DR just by installing and enabling this tool AND NOT using API in the app code in any way memory leakage is created. That leads to false assumptions when developing app based on Three.js. My assumption was first that my code leaks, then that Three.js lib has bug - based on latest tests leakage occurs when this tool is installed in Chrome.

jsantell commented 4 years ago

Thanks for the detailed report! I'll check it out

kroko commented 4 years ago

In that case, you might be able to put __THREE_DEVTOOLS__ = null at the top of your script to disable it on a specific page -- does this only happen when thousands of renderers are created?

Setting to null will not work.

/* global __THREE_DEVTOOLS__ */
if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
  __THREE_DEVTOOLS__ = null; // eslint-disable-line no-global-assign
}

In strict mode will fail with a bang

Uncaught TypeError: Cannot assign to read only property '__THREE_DEVTOOLS__' of object '#<Window>'

In non strict will probably fail silently.

jsantell commented 4 years ago

via https://github.com/mrdoob/three.js/issues/18759, this looks like it was an issue with a large amount of renderers, an edge case with three.js -- closing this issue for now