# why task is not deleted completely?

**URL:** <https://forums.freertos.org/t/why-task-is-not-deleted-completely/4480>\
**Category:** Kernel\
**Created:** [November 5, 2012, 3:26pm UTC](https://forums.freertos.org/t/why-task-is-not-deleted-completely/4480 "2012-11-05T15:26:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 5, 2012, 3:26pm UTC](https://forums.freertos.org/t/why-task-is-not-deleted-completely/4480/1 "2012-11-05T15:26:55Z")

</div>

**[vicui](https://sourceforge.net/u/vicui/)** wrote on [Monday, November 05, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/c757c9de/#02be):

Hi Recard:  
I create a task with STACK RAM 128\*8 Bytes, and use vTaskDelete(handle) in another task,&nbsp; then call vTaskDump to check  
the task status, it is really deleted in task list. then, i create it again. then delete it in anothere task, after about 5 ~ 8 times operation, the vTaskDump show that the task 's status is D(delete), but&nbsp; the task is also in task list. vTaskDump always displayit . after wait 3 minutes ,vTaskDelay still show it . why ? what cause it ?  
by the way , the task is written with socket API, i also close the sockets when delete it .

vincent

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [November 5, 2012, 3:44pm UTC](https://forums.freertos.org/t/why-task-is-not-deleted-completely/4480/2 "2012-11-05T15:44:54Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, November 05, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/c757c9de/#c2d3):

I can’t find any reference to a function called vTaskDump() in the distribution, nor know how a task is created using a sockets() API (are you using a TCP/IP stack?), but talking generally….

When you call vTaskDelete() the task is removed from the pool of tasks that are able to run, and added to a pool of tasks that are waiting to be cleaned up.&nbsp; The actual clean up is done by the idle task.

Are you starving the Idle task of processing time, preventing it cleaning up deleted tasks?

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 5, 2012, 3:48pm UTC](https://forums.freertos.org/t/why-task-is-not-deleted-completely/4480/3 "2012-11-05T15:48:21Z")

</div>

**[jdurand](https://sourceforge.net/u/jdurand/)** wrote on [Monday, November 05, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/c757c9de/#372c):

Or, as I ran into some time back, I had the wrong heap.c loaded so the clean-up pool was never cleaned.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 6, 2012, 12:11am UTC](https://forums.freertos.org/t/why-task-is-not-deleted-completely/4480/4 "2012-11-06T00:11:21Z")

</div>

**[vicui](https://sourceforge.net/u/vicui/)** wrote on [Tuesday, November 06, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/c757c9de/#09fe):

hi rechard:

i am sorry that my words is confusing  
first, i use vTaskList to dump current running tasks,  
second, my task is a&nbsp; net application written by SOCKET API  
as you describe,&nbsp; the idle task doesn’t clean up the deleted task, maybe the idle task hasn’t got control to implement ?  
in my system, there are more than 10 running task together .

vincent
