Quality RTOS & Embedded Software

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


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) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists