Quality RTOS & Embedded Software

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


Loading

malloc/free thread & interrupt-safe

Posted by Joe on April 9, 2007
Hi @all,

I am using the arm7-gcc port of FreeRTOS with the Aeolus-newlib syscall-stub with some modifications and it works fine. But now I have a question concerning the malloc/free-mechanism during interrupts. At the moment i also use the heap_3.c module which uses the standard-malloc/free because I do not have hard deterministic requirements. But I unsure if this malloc/free (sbrk_r) also works during interrupts and if it is thread safe.
Does anyone know more about my requirements or does someone have a solution for my question ?

regards
Joe

RE: malloc/free thread & interrupt-safe

Posted by Nobody/Anonymous on April 9, 2007
You cannot use pvPortMalloc or vPortFree from an interrupt because they use critical sections to ensure they are thread safe. You could use standard malloc and free from an interrupt, provided you only use the thread safe versions from outside of the interrupt.

However, generally it would be considered bad practice to call such a potentially large and non deterministic function such as malloc from within an interrupt in any case.

Dave.

RE: malloc/free thread & interrupt-safe

Posted by Joe on April 9, 2007
Ok, I will check another way to implement my requirements. You have right with the statement of bad practise, may be i will check the possiblity using preallocated blocks

Joe


[ 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