Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

vTaskDelete

Posted by michaeln32 on January 16, 2018

Hi, I create a task using xTaskCreat();

Is it on my responsibility to free all memory usage before delete the task (using vTaskDelete()) or it is done automatically by freeRTOS kernel ?

Is it on my responsibility to free all task stack and task TCB before delete the task (using vTaskDelete()) or it is done automatically by freeRTOS kernel ?


vTaskDelete

Posted by richard_damon on January 16, 2018

vTaskDelete will delete the task stack and TCB (either immediately if deleting another task, or deferred to the I(dle task if a task is deleting itself), assuming the task was created with dynamic memory (for a statically created task, vTaskDelete() will have FreeRTOS stop using that space, so it is now available to use to create another static task), All other resorces that the task has allocated need to be handled by your program, as FreeRTOS doesn't know if they are still needed.


vTaskDelete

Posted by michaeln32 on January 16, 2018

I'm using NewLib instead of FreeRTOS heap.c for dynamic memory allocation algorithm.

NewLib dynamic memory allocation algorithm is different than FreeRTOS dynamic memory algorithm (heap.c).

Are the thinkgs above about the vTaskDelete() operations are the same if I use NewLib ?


vTaskDelete

Posted by rtel on January 16, 2018

I recommend stepping through the very simple vTaskDelete() function in the debugger, or simply just looking at the short piece of source code that implements it, so you can see that Richard Damon's clear answer is correct and holds in all cases - you will be able to see see exactly what the function does and does not do. FreeRTOS has no idea about any memory you allocated from Newlib.


vTaskDelete

Posted by michaeln32 on January 16, 2018

Ok Thanks


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner