Huge amount of Leak Detection warnings inside the multiplayer sample project

I downloaded the sampleproject from GitHub over at GitHub - Unity-Technologies/multiplayer: Unity multiplayer packages and samples

I didn’t change anything, I just go into PlayMode, in this case NetCube, and it gives these warnings…

It is extremely variable on how many I get, sometimes I get internal allocations from age 5, sometimes it goes all the way up to 12, but almost always in blocks of 4 logs.

Full console log for each of them is as following, in the order as the image above, put into code blocks (EDIT: apparently I couldn’t enter multiple codeblocks, so screenshots it is) for easier formatting.

Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak

The constant logging of these warnings is absolutely tanking my FPS and none of the multiplayer samples can be player properly to see what they do. For example, the NetCube scene gives me the most jittery movement I have ever seen. These logs bring down the FPS to 20…

Oh, these logs also continue displaying wether or not Leak Detection is ON or OFF.

Is this normal? Is anyone else experiencing this?

What can I do to solve this?

I dun think it’s normal. I also get similar thing only at the time of loading scene in my project. Seems like this warning spamming only shows up recently. Not sure whether it’s recent Unity version engine bug, Entities package or Burst package bug.

very strange, hopefully @timjohansson or @CMarastoni can clarify this a bit.

This is a known issue caused by TempJob allocations not dealing well with fixed update systems - and the server is fixed update.

We are looking at ways to solve it, but it requires significant changes to how TempJob allocations work in entities so I cannot say when it will be fixed.

The workaround for now is to enable “VSync (Game view only)” in the “Free aspect” dropdown of the Game view tab in the editor.

2 Likes

@timjohansson . This doesn’t work for my project. The behavior of my project is quite different. It only spam warning awhile when just enter playmode then no more spam. Real Android client build also have that same warning spam.

I got something similar. It happens on very fast computers since the tick rate of the fixed server step is 60 and your framerate may be 500 fps.

Is there no way to change the temp allocations warning limit by setting something somewhere in Unity? I think that would help get rid of the warning spam.

@CMarastoni @timjohansson Currently my project get serious issue for this TempJob allocations warning. It keep allocating 1MB per second at both editor and real android build until it crash when it’s out of memory. Can u make sure at least this issue is fixed for next Netcode version even TempJob allocations warning still exists? Make it not allocate 1MB per second anymore. Btw it’s Entities package or Netcode package related issue?

If you are constantly allocating more than 1MB per second then it is a real leak. We are actually disposing the memory. The warning was actually a “false” positive due to the way the TempJob check works.
I’m not aware of any reported leak in 0.6-preview.7 and has been used that in many other projects.
Can you give us some more info about which system did that or where it came from?

@CMarastoni I’m not really sure where the leak came from but I know how to reproduce it in my project. I try find it for long time but still can’t track it yet. I think u can use my repro project project to reproduce this memory leak. From UI Panel, press setting button then quit game button at game scene to go back to main menu scene you should able to reproduce the memory leak issue. If u can’t reproduce it let me know.