If the While Condition of a Coroutine is false is the coroutine halted?

So I have this little tidbit of code:

[Server]
    IEnumerator Regeneration()
    {
        while (!isDead)
        {
            yield return new WaitForSeconds(1f);
            Debug.Log("Regeneration is running.");

            float regenhealth;
            float regenStam;
            float regenMana;

            if (currentHealth < maxHealth)
            {
                regenhealth = healthRegenerationRate;
                //Debug.Log("Player should regenerate health.");
            }
            else
                regenhealth = 0f;

            if (currentStamina < maxStamina)
            {
                regenStam = staminaRegenerationRate;
                Debug.Log("Player should regenerate stamina.");
            }
            else
                regenStam = 0f;

            if (currentMana < maxMana)
            {
                regenMana = manaRegenerationRate;
                Debug.Log("Player should regenerate mana.");
            }
            else regenMana = 0f;

            if (regenhealth > 0f || regenStam > 0f || regenMana > 0f)
            {
                Regenerate(regenhealth, regenStam, regenMana);
            }
        }
    }

When my player dies, isDead is set to true and the coroutine stops - as intended. My question is, is that coroutine completely stopped or do I need to kill it manually?

I’m afraid that I’m actually starting multiple coroutines all in memory with new memory allocated for each one, which will eventually kill the game.

When it goes out of the while loop the coroutine is completely stopped. You do not need to kill it manually or do anything else.

I’m afraid that I’m actually starting multiple coroutines all in memory with new memory allocated for each one, which will eventually kill the game”.

That depends on when you’re calling StartCoroutine(Regeneration()); . If you’re doing it inside a Start (or basically just calling it once) then there’s no problem. If you are calling it inside Update then you do have a problem.

Add

yield break;

at the end of the coroutine and that should make sure the corountine exits once done.