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


pvPortMalloc and vPortFree problem after a vTaskDelete call

Posted by lucabo81 on July 18, 2016


my application is composed by many threads.

One of this threads at each execution alocates some variables in the heap (I'm using the heap_4.c) end free those variables after their use.This task run periodically.

One other thread manage some memory transfer through the DMA and run only one time. At the end of this task, a vTaskDelete(NULL) is called.

Problem is following: Until the second thread is alive, all it's ok. variables of first task are allocates and deletes alwais at same addresses. But when the second thread terminates, FreeRTOS goes in hard fault after the first thread execution.

What can be the problem? Thanks

pvPortMalloc and vPortFree problem after a vTaskDelete call

Posted by rtel on July 18, 2016

I can't really say without seeing more of your application.

Does the Idle task ever get any processing time? If a task deletes itself, which in this case it is, the heap and TCP used by the task will be freed in the Idle task, so if the Idle task is not running the memory will never get freed - but that should not result in a crash unless you run out of heap without noticing and subsequently attempt to access a NULL pointer.

Other than that, the usual replies apply (do you have stack overflow checking on, do you have configASSERT() defined, have you tried to debug the hard fault, etc.) info on all of which can be obtained from the following page: http://www.freertos.org/FAQHelp.html

[ 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