Quality RTOS & Embedded Software

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


Loading

Has anyone modified heap_4.c to add an optimized realloc?

Posted by cdebrebisson on May 10, 2017

Hello,

Well, I guess the whole question lies in the title. I have been batteling between using the FreeRTOS provided heap management and the compiler provided memory management. The FreeRTOS scheme is winning at the moment because I can easely make isso that the memory size is defined at run time and not comile time (since the board can be loaded in the factory with any size RAM)... However, I do need a realloc and I would like it to be more optimized than a basic malloc/copy/free scheme (ie: free extra ram if shrink and grow in place (if possible)).

Has anyone ever implemented such function in heap4.c?

Cyrille


Has anyone modified heap_4.c to add an optimized realloc?

Posted by richard_damon on May 10, 2017

If you want realloc, I would go to heap_3.c and use that method. The other option which is available with some implementations, is to see if your library has hooks in it to make malloc/free/realloc thread safe (I know some versiion of newlib have this).


Has anyone modified heap_4.c to add an optimized realloc?

Posted by cdebrebisson on May 10, 2017

Hello,

Except that this assumes that the linker does have a free/malloc/realloc, which is not the case for me (well, more specially, I do not want to use their versions because I can not modify them and make them able to deal with my ram which is of unknown size at build time. Size is detected at run time).

Cyrille


Has anyone modified heap_4.c to add an optimized realloc?

Posted by rtel on May 10, 2017

Most people use a crude free and re-allocation. I'm not aware of anything more sophisticated.


[ 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