Quality RTOS & Embedded Software

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


Am I running out of memory?

Posted by colingd on June 12, 2018

Hi all,

So I ported FreeRTOS. Tested the tick frequency with an oscilloscope. All fine but it seems I still have something to figure out. I'm trying to test the demos found in the common directory. I'm taking for reference the official port to AT91SAM9XE. There are good news. All the demos work perfectly one running on their own. Then I have them run concurrently it seems the I'm running out of memory when vTaskStartScheduler is called. The main starts by calling the functions that start the demos, creates a task that checks that the other tasks are runing and starts the scheduler. I'm trying to debug this and when I call vTaskStartScheduler it will get stuck here eventually : 814 xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;; in the task.c file. I'm using heap_2.c . And you can have a look at my repo here : https://gitlab.in2p3.fr/colingd/freertos-template

Thanks in advance!


Am I running out of memory?

Posted by rtel on June 12, 2018

Yes, it would seem you are running out of memory.

If you are using heap2 then the amount of heap you have is defined by configTOTALHEAP_SIZE. You can set that up until your application will no longer link, the you know how much total heap you have. Be careful to also remove any heap that is being allocated by your C run time (the heap that is used when malloc() is called instead of pvPortMalloc()) - otherwise it will just consume space that is never used.

You can then look at tuning the sizes of the stacks allocated to the tasks. You can use the API or kernel aware plug-ins to see how much task stack remains unused, and tune accordingly.

Am I running out of memory?

Posted by colingd on June 13, 2018

Mr. Barry,

Thanks for answering! The answer nows seems obvious, I should have been more careful whilst reading the documentation and known better. I will look into this. However, the demo now works! I tried to publish my repo link to freertos interactive but I'm having issues with logging in freertos interactive.

Thanks for your time, it is greatly appreciated!

Colin González

[ 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.


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





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