Garbage Collection in DOTS?

Hello! I am a beginner in unity dots and monobehaviours but I am heavily focused on learning dots. I started building a very small project with just a few basic scripts using pure dots exclusively. Everything works fine around 5ms per frame but occasionaly i get big spikes with 130-140ms a frame. Using the profiler I have noticed that it doesn’t have to do with my scripts at all but with the rendering of the scene which freezes it. I have installed entities 0.7 and the hybrid renderer 0.4 (something strange that i noticed is that its dependency is entities 0.8 but somehow it works). I will provide you with the screenshot of the profiler. Can someone give me some insight of what’s happening? Thank you a lot.

The GC spike is being triggered by the NativeContainer safety system. This is simply a debugging tool and does not exist in builds. You can also disable it in the editor, though unless you are A/B-ing a Burst optimization, is not recommended.

I am surprised you are accumulating GC quick enough to notice these spikes though. Are you sure none of your scripts are generating GC?

I could write here my scripts but it might take a bit to think in terms of GC

Here they are. The rest are just tags with authoring components. I don’t really have an idea in terms of GC. Does DOTS need GC btw?

5594662–578320–BowSpawnSystem.cs (2.23 KB)
5594662–578323–Movement.cs (981 Bytes)
5594662–578329–GameHandler.cs (4.46 KB)
5594662–578335–PrefabEntity.cs (143 Bytes)

You can check the GC Alloc column in the profiler hierarchy view. Outside of the safety sentinels, core DOTS with struct components should be GC-free.