Quality RTOS & Embedded Software

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


Loading

Stack after vTaskDelete

Posted by Bart on June 18, 2010
Hi,

I have a task that is called out by an ISR, when i press a button. This task creates another task. When i press the second button, ISR calls a third task that uses vTaskDelete to delete the second task.

Now before I create the second task, im checking available stack size by calling xPortGetFreeHeapSize(). I'm calling it again just after vTaskDelete deletes the second task. And the numbers don't match. Why is that? I thought all the memory should be freed after calling vTaskDelete. After few ISR's I'm getting a stack overflow. I'm using heap_2.c

RE: Stack after vTaskDelete

Posted by Dave on June 18, 2010
“I have a task that is called out by an ISR, ”


Do you mean unblocked by an ISR? I don't know what called out means.

“ISR calls a third task that uses vTaskDelete to delete the second task. ”


Again I don't really understand what you mean in this sentence. Tasks should not be called by an ISR so I suspect I just don't understand your terminology.

“Now before I create the second task, im checking available stack size by calling xPortGetFreeHeapSize(). ”


xPortGetFreeHeapSize() tells you the heap size, not the stack size.

“I'm calling it again just after vTaskDelete deletes the second task. And the numbers don't match. Why is that? I thought all the memory should be freed after calling vTaskDelete. After few ISR's I'm getting a stack overflow. I'm using heap_2.c”


When a task is deleted the heap memory that was allocated to the task is freed from inside the idle task (by default anyway). Therefore you would not expect the numbers to match until the idle task had executed at least one cycle.

RE: Stack after vTaskDelete

Posted by Bart on June 21, 2010
Sorry, I meant 'unblocked by ISR'. The problem was the Idle Task - it was starved out of processing time. Everything works fine now, thanks.


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


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

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