Skip to content

Conversation

@ryantrem
Copy link
Member

With React hooks, a state setter can optionally take a lambda that receives the old state value and returns the new state value. We were relying on this to get the old NativeEngine instance and dispose it when the containing component is unmounted. However, what I have found is that the state setter lambda is not actually invoked during an unmount, and so we were not disposing the NativeEngine instance, which resulted in the XR session not being exited or cleaned up, which meant we were leaking a very large amount of memory if the EngineView is unmounted while in XR mode. Other resources are leaked as well in this scenario, but the XR resources are most noticeable.

This change also updates to the latest BabylonNative submodule, which brings in XMLHttpRequest memory leak fixes as well.

This change (including the BabylonNative update) addresses the bulk of #102.

@ryantrem ryantrem requested review from Alex-MSFT and bghgary October 28, 2020 15:29
@ryantrem ryantrem merged commit 19e9cdf into BabylonJS:master Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants