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




Loading

Appart of the tasks stacks, what is in FreeRTOS heap ?

Posted by damv100 on November 3, 2015

Hi everybody,

I got a question on the use of the heap of freertos.

I have configured the total heap size to 4200 bytes :

define configTOTALHEAPSIZE ((size_t)(4200))

I us all this space since when I call xPortGetFreeHeapSize() I got 10 so only 10 bytes are unused.

However, I don't understand how this space is used. In fact if I sum the sizes of the tasks stacks, I get only 2000 bytes :

task1 -> 125 words -> 500 bytes task2 -> 125 words -> 500 bytes task3 -> 100 words -> 400 bytes idleTask -> 50 words -> 200 bytes (configMINIMALSTACKSIZE = 50) timers -> 100 words -> 400 bytes (configTIMERTASKSTACK_DEPTH = 100) TOTAL 2000 bytes

Is it normal ? Is there any way to knwow what use the other half of the freeRTOS heap ?

Thank you for your help

Damien


Appart of the tasks stacks, what is in FreeRTOS heap ?

Posted by rtel on November 3, 2015

When you create a task both the task stack and the task control block (TCB) come from the heap. If you creates queues or semaphores then the memory from those comes from the heap also. Direct to task notifications are faster than semaphores and do not use memory from the heap. http://www.freertos.org/a00111.html


Appart of the tasks stacks, what is in FreeRTOS heap ?

Posted by damv100 on November 3, 2015

Thank you a lot for this quick and clear answer.

I use : - 1 queue of 6 elements of 1 byte - 4 binary semaphores - 1 mutex - 3 timers

Do you think it explains the 2kB use of heap ?

If so, is there anyway to evaluate the size of each one to replace the bigger elements ?


Appart of the tasks stacks, what is in FreeRTOS heap ?

Posted by rtel on November 3, 2015

Probably not.

You can use FreeRTOS+Trace to see memory allocations.


Appart of the tasks stacks, what is in FreeRTOS heap ?

Posted by damv100 on November 3, 2015

I didnt manage to make the openOCD work on my target, so bumping the memory to get the freeRTOS+trace output is a problem. Is there any other way ?


Appart of the tasks stacks, what is in FreeRTOS heap ?

Posted by damv100 on November 4, 2015

Any idea ?


Appart of the tasks stacks, what is in FreeRTOS heap ?

Posted by rtel on November 4, 2015

Other than using the trace, I think you would have to add code, or put a break point in pvPortMalloc() to see what was calling it.


[ 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