EnoxSoftware / HoloLensWithOpenCVForUnityExample

HoloLens With OpenCVforUnity Example (Support for Hololens1 and Hololens2)
MIT License
262 stars 50 forks source link

Repeatedly enabling/disabling camera crashes the app. #20

Closed Tamulur closed 1 year ago

Tamulur commented 4 years ago

I need to enable/disable marker detection repeatedly in my app. Doing this in this example app (switch between Aruco example and main menu back and forth) crashes after a while, unless I build the app in Debug configuration. How to safely disable/enable marker tracking repeatedly?

EnoxSoftware commented 4 years ago

Thank you very much for reporting. Does this crash only occur when running ArUcoExample?

Tamulur commented 4 years ago

So far yes. I tried Comic filter, face detection and Aruco calibration, and they haven't crashed for me yet.

Abdul-Mukit commented 3 years ago

I think this is the reason. VulcanTechnologies/HoloLensCameraStream#29 I faced a similar sort of problem. Repeatedly stopping/starting the camera overtime caused higher RAM usage until eventually, the app would crash. For my application, I eventually put the camera helper and dlib script on a prefab. Every time I needed to stop the camera I would destroy the GO with the camera script. When I want to resume service, I create another instance of that prefab. It solved the memory issue for me. For my application, I don't need this start/stop too often so the small delay during initializing the new instance was not a big deal for me.

Tamulur commented 3 years ago

Thanks for the info!