Profiler and Garbage Collector with coroutine

Hi guys, I worrying about a thing. Maybe @Eric5h5 can help me because he’s an expert with coroutine. If I’m profiling without Deep Profiler, my empty coroutine is allocating 9B each frame. If I’m profiling with Deep Profiler, my empty coroutine is allocating nothing each frame. So can someone advise me on coroutine and allocation? Which one should I trust, or maybe their profiling job isn’t the same.

Here’s the coroutine:

		private void Start ()
				StartCoroutine (Test ());

		private IEnumerator Test ()
				while (true) {
						yield return null;

Here’s the profiler without Deep Profile enabled:

Here’s the profiler with Deep Profile enabled:

Thanks in advance guys

Well, your particular coroutine doesn’t allocate anything. The 9B might be something Unity-internal, maybe it’s even caused by the profiler itself :P. Fact is that all you do in the MoveNext method of your coroutine object is setting the current value (which is a member variable of the coroutien object) to null which doesn’t allocate any new memory. Have you tried starting the same coroutine 1000 times? Any changes?