hiukim / mind-ar-js

Web Augmented Reality. Image Tracking, Face Tracking. Tensorflow.js
MIT License
2.14k stars 394 forks source link

[image-target] web worker instance registered in the controller stays in browser after removing the a-scene element from the DOM #313

Closed jotatoledo closed 1 year ago

jotatoledo commented 1 year ago

image

While working inside a relatively simple react SPA using the library, I noticed that multiple mount/unmounts of the same component with a <a-scene mindar-image=....>....</a-scene> results in multiple workers not being disposed, which finally leads to a very slugish performance of the app when the scene is rendered

jotatoledo commented 1 year ago

Just noticed in a locally patched v1.1.5 (havent tried with the latest version) that despite the changes in #314 my application still becomes very sluggish after mounting/unmounting the scene as described in the issue. @hiukim any hints as to what elements could be causing this? seems to be some sort of mem leak/resources not been disposed when appropiate.

hiukim commented 1 year ago

Can you confirm the issue is caused by mounting/unmounting? There is no leak if you keep running the app without mounting and unmounting? @jotatoledo

jotatoledo commented 1 year ago

@hiukim I didnt saw/noticed any performance issues when running the same scene (single and multitargets) over a long period of time. If you need I might try to setup a small repro. Thanks for the quick responses 👍

hiukim commented 1 year ago

Sure, that could be useful.