VR Applications Hit Memory Limit in About 1 Minute

I have two VR applications that I am trying to testing on an Apple Vision Pro device. Both of these applications (Job Simulator and Vacation Simulator) are old VR applications using the built-in render pipeline and run without issue on a Quest 1 and Quest 2.

When I deploy these applications to a device the applications crashes after about one minute due to hitting the high watermark memory limit (5120 MB).

The Unity Profiler shows the majority of the memory as untracked.

Using Instruments from Xcode to profile the process seems to indicate that MetalScratchBuffers are being allocated a lot and not released. Many of the buffers appear to be related to the ParticleSystem.

Is this a known issue with a workaround I can employ while still here at the Apple Developer Labs?

I went through our first scene of Job Simulator and disabled as many ParticleSystems as I could then re-ran the application on device. The issue still occurs but this time I don’t see anything related to ParticleSystems.

I have uploaded the memory trace files to Google Drive and linked them below:

Before ParticleSystem Removal
After ParticleSystem Removal

What version of Unity are you using?
There is a significant memory leak we had been experiencing on 2022.3.9 with render textures not getting released from memory. 2022.3.10+ has most of those resolved.
Haven’t been able to test ours on device so not 100% that’s the same issue you are seeing.

1 Like

We are still on 2022.3.9. I’ll give an upgrade a try next time. Thanks, @kayke.

I have the same issue with an app using the built-in render pipeline on Unity 2022.3.10. After about a minute, it crashes by hitting the high watermark memory limit…

2 Likes

That’s great to know. Perhaps I should give 2022.3.11 a try then?

@kayke Are you using the built-in render pipeline?

We are using URP, so may not be the same issue.
Be worth to try out the latest though. Are you seeing memory build up in editor?

I’m finally up to date on the latest plugin release (0.4.3), VisionOS SDK/firmware (Beta 4), and built using Unity 2022.3.11 (and I also use the built-in render pipeline). The issue remains - hitting the memory high water mark after a minute or two… @OwlchemyDawson - did you make any progress on this?

Unfortunately, I have not made progress on this one yet. :frowning:

Does anyone on the Unity side have any insight here based on the memory traces that @OwlchemyDawson posted? I would like to try to get a repro project together, but I don’t have any clues yet which parts of our projects are leading to this memory leak (besides maybe particle systems contributing to the speed we run out of memory, but doesnt seem to be the silver bullet).

After updating our project to Unity 2022.3.11f1 we started hitting some really low level memory leaks that were making Unity hard crash after 1-2 minutes of running our game, consistently.

Not sure if its related at all, but we ended up rolling back to 2022.3.10f1 and things are much more stable again.

Thanks for the insight, but we have seen the memory crashes in both 2022.3.10 and 2022.3.11. I’m gonna start stripping back one of our scenes bit by bit next week to see if I can gain any additional insights, and update here.

Now that I’ve had a chance to get more of our app up and running on the VisionPro, I can confirm that we also crash out of memory at around 1-2 minutes in, even on 2022.3.10f1 (using URP).

Also hitting “Too much memory” on 2022.3.10f1 (modified, but that doesn’t seem to be the cause of this) with URP VR app after a minute or two.
When “Run in Xcode as” is set to “release” it seems to run for longer (or in fact not run out).
Thank you everyone for posting this, looking forward to solving this.

1 Like

Same issue on 2022.3.11 in URP here. Runs fine for 1-2 mins then crashes complaining about memory limit.

OK I finally was able to make a repro project for this - it seems it just requires a single particle system that’s emitting constantly. I submitted a bug report with the repro project, its IN-60593

You can also find the repro here:

Hopefully this helps folks on the Unity side resolve this, thanks :slight_smile:

1 Like

Is there anything further we can provide to the Unity team to help get this resolved? We are currently blocked on VR game testing due to these memory leak issues.

@OwlchemyDawson – You say this is a VR game - can you confirm that you have the polyspatial runtime disabled (and no package)? If so, do you get a similar memory leak if you run on another platform - such as desktop or iOS? Or does it seem to be unique to visionOS?

This issue appears to be unique to the visionOS platform. None of our VR projects have the PolySpatial packages in them and all of them are projects that have current production releases on Steam and the Meta Quest platforms without memory leaks. Also of note is that all of our VR projects use the built-in render pipeline. @puddle_mike posted a repro project above that sounds like it reproduces this memory issue with a very simple project and a single particle system.