Memory Leaks in beta

Recently upgraded from 2022.1 to the beta & have been having some serious issues. After a few play sessions my performance degrades so much that I need to restart the editor. From profiler analysis it appears caused by semaphore.WaitForSignal. I take it this means I’m waiting on the GPU which has it’s memory pretty well maxed out?

I’m getting warnings at the end of each play sessions along the lines of -

[Worker0] Internal: There are remaining Allocations on the JobTempAlloc. This is a leak, and will impact performance

[Worker0] To Debug, run app with -diag-job-temp-memory-leak-validation cmd line argument. This will output the callstacks of the leaked allocations.

Potential race-condition clearing GeometryJob fences

Burst settings (Probably relevant) are as followed -

  • Enable Compilation On
  • Safety Checks Force On
  • Leak Detection Full Stack Trace (Expensive)
  • Jobs Debugger On
  • Use Job Threads On

On a Windows Machine - DX12
Issue found on version 2022.2.0b16, b15, b14

The only references I could find to do with geometry fences are linked to Unitys legacy UI (Which I’m using). Also using UI Toolkit. Slowly switching stuff over.

I was using compute shaders/buffers & burst jobs but have since disabled all personal instances in pursuit of tracking this down. Still getting the errors above though, which are so far my best lead.

“run app with -diag-job-temp-memory-leak-validation cmd line argument. This will output the callstacks of the leaked allocations.” Seems like my best bet to track this down, but I’m unsure how exactly to run the app through cmd with additional arguments.

Any help, especially some more detailed instructions on how to run that cmd line argument, would be much appreaciated.

Cheers,
Dan

3 Likes

I can confirm this. I have no Idea what is causing the leaks, but I have similar issues/warnings on MacOS Ventura using metal as well. Performance is restored upon restart.

Might be related to this Performance Issues in Unity Editor on Ventura (2021.3.10f1)

1 Like

Defintitely getting occasional crashes too. Attached crash dump & log of the latest. Can provide more if it helps.
For what it’s worth, definitely seeing stability improvements over the beta patches. Keep up the good work!

8610381–1155654–crash.zip (509 KB)

Hate to say it, but looks like DX12 was the issue. Swapped back to DX11 in editor & it runs like butter. No issues.

I’m sitting on 3000 batches + a ton of custom compute + GPU instanced bullsh*ttery. I tried minimalising the scene & removing all the custom GPU stuff but the problem persisted, so we might be able to rule these out. I’m using both legacy GUI & UI toolkit too, so that probably doesn’t narrow it down too much.

Tried both forward & forward+. MSAA is definitely on. Maybe that helps? For now I’m just going to stick with DX11.

Hi @DanielDickinson ,

Would you be able to submit a bug report with a reproducible for the memory leaks? I have shared the thread with the devs but it’s not clear from the information here what causes the issue.

1 Like

Hey, thanks for taking the time to respond!

I’ve narrowed down the majority of the memory leaks to - StaticBatchingUtility.Combine creating meshes & not automatically cleaning them up when exiting play-mode. This is easy enough to do with Resources.UnloadUnusedAssets before the game ends but after the world tiles have been destroyed. I definitely expected this to happen automatically though. It seems this is by design? Not sure why but it’s not too hard to get around.

I was generating & batching 18km square terrains in 6km tiles every time I tested the game, so this leaked a lot very quickly. In comparison, the rest of the leaks I was getting errors for are fairly trivial & aren’t slowing me down too much.

I’ve just upgraded to the first release candidate, I’ll check DX12 & report back if their are any issues.
Again, thanks for taking the time to check in! Happy holidays!

1 Like

Had this warning spam when using 1.0.0-pre4 AI Navigation, had to update to newest hidden version together with new Samples.

Wow, didn’t know multiple people had this problem. I filed a bug report 2 weeks ago, so far without any results, lets see

1 Like

I received this too, is any way to fix it?