Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

vPortFree() is not called

Posted by ganix22 on December 1, 2014

Hi, I have a simple project for STM32L-Discovery board which uses FreeRTOS and I want to delete "Task 2" but it seems that memory is not freed after calling vTaskDelete(), even after replacing memory management scheme from heap1.c to heap2.c (I also tried heap3.c and heap4.c without success). I tried using debugger but there is no sign that vPortFree() is called anyway.

~~~~~~ void Task_1(void* pvParameters){ int i;

unsigned portBASE_TYPE uxPriority;

volatile size_t xHeapSize;

uxPriority = uxTaskPriorityGet(NULL);

while(1){ LED1ON();

xHeapSize = xPortGetFreeHeapSize();

// Create task
xTaskCreate(Task_2, "Task 2", configMINIMAL_STACK_SIZE, NULL, uxPriority+1, &xTask2Handle);

LED_1_OFF();

for(i=0; i<0xAFFFF; ++i);

}

// Delete current task vTaskDelete(NULL); }

void Task_2(void* pvParameters){ // Do something...

// Delete current task vTaskDelete(NULL); } ~~~~~~

Some configs from FreeRTOSConfig.h:

~~~~~~

define configCPUCLOCKHZ SystemCoreClock
define configUSE_PREEMPTION 1
define configUSEPORTOPTIMISEDTASKSELECTION 1
define configUSEIDLEHOOK 1
define configUSETICKHOOK 1
define configMAX_PRIORITIES ( 5 )
define configMINIMALSTACKSIZE ( ( unsigned short ) 70 )
define configTOTALHEAPSIZE ( ( size_t ) ( 14 * 1024 ) )
define configMAXTASKNAME_LEN ( 16 )
define configUSETRACEFACILITY 1
define configUSE16BIT_TICKS 0
define configIDLESHOULDYIELD 1
define configUSE_MUTEXES 1
define configQUEUEREGISTRYSIZE 5
define configCHECKFORSTACK_OVERFLOW 2
define configUSERECURSIVEMUTEXES 1
define configUSEMALLOCFAILED_HOOK 1
define configUSEAPPLICATIONTASK_TAG 0
define configUSECOUNTINGSEMAPHORES 1

/* Software timer related definitions. */

define configTIMERTASKPRIORITY ( configMAX_PRIORITIES - 1 )
define configTIMERQUEUELENGTH 10
define configTIMERTASKSTACKDEPTH configMINIMALSTACK_SIZE

/* Co-routine definitions. */

define configUSECOROUTINES 0
define configMAXCOROUTINE_PRIORITIES ( 2 )
define INCLUDE_vTaskPrioritySet 1
define INCLUDE_uxTaskPriorityGet 1
define INCLUDE_vTaskDelete 1
define INCLUDE_vTaskCleanUpResources 0
define INCLUDE_vTaskSuspend 1
define INCLUDE_vTaskDelayUntil 1
define INCLUDE_vTaskDelay 1

~~~~~~


vPortFree() is not called

Posted by edwards3 on December 1, 2014

The memory is not freed until the idle task runs. Does your code let the idle task run?


vPortFree() is not called

Posted by ganix22 on December 1, 2014

Of course, you're right! Instead of using for() wait loop there should be vTaskDelay(). Thanks!


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists