Memory Leak Issue Body Tracking Unity

Hello,

I’m Using Unity 2021.3.22f1 Zed SDK 4.1.2, when I “Enable Tracking” under “Body Tracking” in the Zed Manager memory continues to be rapidly allocated until eventually the application crashes. I have tested with cuda 11 and cuda 12 on a GTX 1080ti and a Quadro RTX 3000 and getting the same result. Wondering if anyone else is experiencing this also?

Cheers,
Declan

Hi,

Thanks for the report.

I’ll try to reproduce your problem on my side and I’ll come back to you once I have some news.

Best,

1 Like

We are running into the exact same thing. Just running the “BodyTrackingSingle” from the included examples will eat up massive amounts of memory that isn’t released, eventually crashing the app.

@jakkomm did turning off the enable tracking also stop the memory being released in your project?

Correct. Turning tracking off will not eat away the memory, and the amount used remains stable. I do not know if memory is released then or just not allocated each frame. The memory profiler shows that “untracked” memory grows if tracking is enabled.

This is also reproducible in the editor itself. The BodyTrackingSingle scene with tracking off: 2.4 GB. With the tracking checkbox on: 10+GB after a couple of minutes.

I have a couple of videos demonstrating this but I’m not allowed to upload attachements

Hi,

Sorry for the delay.
I just pushed a fix for the leak on the master branch of the repo.
Let me know if you still have the issue on your side.

@BenjaminV Thank you for the update.
Preliminary testing shows that memory usage now remains stable when the “Enable Tracking” checkbox is enabled. Both in our app and in the example scene.

However, body tracking now -only- works if that checkbox is enabled. This is a regression. You can reproduce this in the “BodyTrackingSimple” example scene. Turn it off and the avatar will not appear.

The naming of that checkbox is confusing anyway, the tooltip explains that it is to enable tracking across multiple frames while the name suggests it is for tracking in general.

I will continue testing next week, but we won’t use it in production just yet as I already had a solution in place that deals with tracking loss between frames.

Hi,

Thanks for the feedback.

Enabling the tracking of the detection is required in Unity. Indeed, without it, we can’t track if a person is detected over multiple frames and we can’t know if we need to spawn a new Avatar (or destroy it).
It is explained in the tooltip but I agree that’s not enough, we should also log it in the console. That’s very unclear at the moment.

I really don’t understand the what the meaning of that checkbox is then. I just thought it was just an additional layer of tracking reliability.

Before the memory fix: body tracking works if it is off. Although very sensitive to tracking losses.
After memory fix: body tracking ONLY works if it is on.

But that’s okay. Although if someone updates to the newer version and has the “EnableTracking” turned off to not make the app crash, they will discover that after the update all body tracking doesn’t work anymore without a clear reason why

In some cases, when you only want to know the joint positions of a person and not to animate a 3D model, the tracking can be optional.

Before the fix, the option was broken, and the tracking was always ON.

I’ll add a warning in the examples scene to explain that.

Thanks again for the feedback.