Quality RTOS & Embedded Software

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


Loading

while creating a task, 4 times the ram is malloc'd than requested @ prvAllocateTCBAndStack()

Posted by hassan789 on August 26, 2016

When createing a task with 4kB of stack, prvAllocateTCBAndStack() executes the following line:

pxNewTCB->pxStack = ( StackType_t * ) pvPortMallocAligned( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ), puxStackBuffer );

This does a mallco of 4kB * sizeof( StackType_t ).. which means it mallocs 16kB... why is that?

I am running FreeRTOS v8 and Heap4

Thanks


while creating a task, 4 times the ram is malloc'd than requested @ prvAllocateTCBAndStack()

Posted by rtel on August 26, 2016

Please see the documentation for the xTaskCreate() API function: http://www.freertos.org/a00125.html


while creating a task, 4 times the ram is malloc'd than requested @ prvAllocateTCBAndStack()

Posted by richard_damon on August 26, 2016

Requested stack size is define to be in units of StackTypeT, not bytes. Due to alignment reasons, it MUST be a multiple of StackTypeT, so it is given in units of StackType_T.


while creating a task, 4 times the ram is malloc'd than requested @ prvAllocateTCBAndStack()

Posted by hassan789 on August 26, 2016

understood.. thanks


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo, Nuvoton Cortex-M23 demo & STM32H745 dual core (AMP) demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

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

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Mediatek

Renesas

RISC-V

SiFIve RISC-V

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