Quality RTOS & Embedded Software

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




Loading

pvPortMalloc and vPortFree problem after a vTaskDelete call

Posted by lucabo81 on July 18, 2016

Hi,

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) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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