# Handling a task in eDeleted state

**URL:** <https://forums.freertos.org/t/handling-a-task-in-edeleted-state/22636>\
**Category:** Kernel\
**Created:** [February 26, 2025, 6:23am UTC](https://forums.freertos.org/t/handling-a-task-in-edeleted-state/22636 "2025-02-26T06:23:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mehran](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@Mehran](https://forums.freertos.org/u/Mehran)\
**Post date:** [February 26, 2025, 6:23am UTC](https://forums.freertos.org/t/handling-a-task-in-edeleted-state/22636/1 "2025-02-26T06:23:17Z")

</div>

Hi everybody  
Is there any situation in which kernel decides to delete a task ? In other words, should I check a task’s state regularly in my task handler ? If there is a need, how should I delete this task completely after detecting that the state is eDeleted ? Regard the assumption that idle task is starved.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [February 26, 2025, 7:07am UTC](https://forums.freertos.org/t/handling-a-task-in-edeleted-state/22636/2 "2025-02-26T07:07:15Z")

</div>

> [@Mehran](#):
>
> Is there any situation in which kernel decides to delete a task ? In other words, should I check a task’s state regularly in my task handler ?

No, the FreeRTOS Kernel does not delete a task until you explicitly call vTaskDelete.

> [@Mehran](#):
>
> If there is a need, how should I delete this task completely after detecting that the state is eDeleted ? Regard the assumption that idle task is starved.

There are 2 possible cases:

1. A task deletes another task: In this case all the resources (task stack and TCB) are released in the vTaskDelete itself.
2. A task deletes itself: In this case all the resources (task stack and TCB) are released by the IDLE task. It is your responsibility to ensure that the IDLE task is not starved to ensure that the resources are released.
