Quality RTOS & Embedded Software

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




Loading

heap_4 uses more memory that heap_3

Posted by trob76 on December 18, 2015

I am integrating FreRTOS 8.2.2 into a legacy project. In addition, I am trying to incorporate TCP+ example code. The old coding used heap3 for the heap model and the TCP+ requires heap4. When I use heap4 the build fails saying that the heap memory has overrun it size. I can only use half the size for heap that I need. I am using armxilinx_eabi and an ARM9 in a ZYNQ.

Why are the heap requirements so much more in the heap_4? Is there a way to use the same heap size?


heap_4 uses more memory that heap_3

Posted by rtel on December 18, 2015

There are no differences in the amount of heap required or used when switching from heap3 to heap4, the only difference is how the heap is allocated.

When you use heap_3 the heap is allocated by the development tools, and does not form part of the data that is located by the linker, and so the linker does not take its size into account.

When you use heap4 the heap is basically a statically allocated array, which is located by the linker - and the linker has to fit it into its memory map. The size of the array that is used as the heap is defined by the configTOTALHEAP_SIZE setting.

Remember that, when using heap_4, provided no other code is calling malloc directly, you can set the size of the heap allocated by the tools to as close to 0 as the tools will allow (normally 4 bytes).

See http://www.freertos.org/a00111.html for more details.


[ 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