Unity Editor Memory Leak

I noticed a few weeks ago that when using OpenXR in Unity and cycling Play Mode on and off (in Editor), I get a near 500MB memory leak everytime Play Mode is stopped. This can be seen in the A-B comparison below. This happens even on a fresh project with just OpenXR added and a simple XRRig in the scene. It seems like something is preventing Unity from fully clearing the Managed Memory. I reached out to Unity but they say they haven’t been able to replicate the issue. Any ideas?

Can confirm this happens on both Vive Pro 2 and Index.

I found the bug you submitted to Unity. My team will grab it and take a look and report back.

3 Likes

Sounds good! I’m surprised this issue isn’t more well known. Is there any way to clear the leaked memory in the meantime? Thanks!

Hey, we investigated this and couldn’t reproduce (responded via the bug asking for more info - but I’ll post it here too):

I’ve been trying to investigate this although I haven’t yet been able to reproduce the memory leak on my side, even after trying multiple versions of Unity, OpenXR, and SteamVR. I had a few questions for you to help me try to investigate:

  1. How consistently do you see this memory leak? Do you see this every time you start Unity and enter/exit playmode?
  2. How many times approximately do you have to enter/exit playmode in order to see the 500MB memory leak?
  3. To confirm, are you using Unity 2022.1.14f1 and OpenXR 1.4.2? (These were the versions that the logs specified) Have you seen this for other versions?
  4. What OS are you using?
  5. What runtime are you using? (The logs indicated you’re using SteamVR) Have you noticed the memory leak for other runtimes as well?

Thanks

For anyone else that finds this: we were eventually able to reproduce this and it turns out it can be reproduced without OpenXR or XR in general. We’ve passed it along to the Unity platform / scripting team to investigate.

2 Likes

Just fyi, doesn’t look like a fix is being worked on. Really annoying since I am getting editor crashes after entering/exiting playmode a certain amount of times. Makes iterative testing a pain…
image

It’s still being investigated - it was transferred to another team because we don’t think it’s being caused by OpenXR (we were able to reproduce it without XR enabled). The connection to your issue got closed for some reason. Should be open again now.

1 Like

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.