Quality RTOS & Embedded Software

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




Loading

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)?

Thanks.


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

Regards.


[ 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