Quality RTOS & Embedded Software

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


Direct using pvPortMalloc() and vPortFree()

Posted by znatok on November 10, 2013

Hi, In my application I need some malloc/free mechanism. Considering that FreeRTOS already has pvPortMalloc() and vPortFree() I plan to use this functions instead of invoacation of the standard library. I have a few questions regarding this: 1. Is it generally OK to use FreeRTOS for heap management not only related to FreeRTOS resources. 2. Are this functions thread safe? 3. I'm currently using heap2. I've read about fragmentation problem so I plan to pass to heap4 unless heap_2 has best match allocation? I mean if I'm going to allocate and free blocks of let's say 100 and 50 bytes in random order am I going to end up with memory luck for 100 bytes block (as all memory will be 50 bytes fragmented)?


Direct using pvPortMalloc() and vPortFree()

Posted by richardbarry on November 10, 2013

Yes it is fine to use pvPortMalloc() and vPortFree() in the application.

Yes they are thread safe.

Best to use heap_4.c


[ 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.

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.


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


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