Quality RTOS & Embedded Software

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


FreeRTOS - long time stability?

Posted by grunfalan on November 2, 2008
Hello friends,

For some time now, I am trying to find a good RTOS that I am going to use in my future projects with AVR microcontrollers. FreeRTOS is one of my favorites now, but as I don't have any experience with RTOS, some questions started to emerge.

I found information (on SafeRTOS FAQ) that SafeRTOS uses static memory allocation for RTOS data instead of dynamic, which is used in FreeRTOS - and therefore it is more safe and stable.

Also, on this forum, somebody mentioned memory leakage, as if it is something usual and inevitable with FreeRTOS.

Does it mean that application with FreeRTOS can not be made for long time stability and 24/7/365 work? If that's the case, could it be avoided with some careful programming technique? How big is this problem in practice?

I want to use it in a device that is placed on distance location, and should work for a long time without "freezing".
I already built the device without RTOS (foreground/background system), and it works very stable on several locations, but now I am considering using RTOS because of easier upgrade/mantaining.

Does use of FreeRTOS increase possibility of fallouts?

As I said, I am a complete newbie concerning RTOS, and any comment or experience will be valuable to me.


RE: FreeRTOS - long time stability?

Posted by Richard Damon on November 2, 2008
I suppose it depend what you do. From my inspection of the code, the only dynamic memory that is used is for the creation of tasks, queue and related objects. If you program creates all of these that are needed at start up, then the dynamic nature of the allocation isn't an issue for long term operation.

RE: FreeRTOS - long time stability?

Posted by Richard on November 2, 2008
This is correct - memory is required each time a task, queue or semaphore is created, and freed when the same task/queue/semaphore is deleted.

In FreeRTOS.org the memory is obtained from the [pseudo] heap, whereas in SafeRTOS the memory is provided by the application. Although the SafeRTOS application is free to obtain this memory in any way it wants, in a safety critical application normally only statically declared buffers would be used as generally dynamic allocation has problems regarding non-deterministic allocation/free times and with fragmentation (memory pools can be used to fix some of these issues but these are complex to use and tune, so are not safer).

If you never delete a task, queue or semaphore then memory is never freed so you have no issues to worry about in that regard. Also the schemes used in FreeRTOS.org are very simplistic, and the way memory is allocated so restricted, that generally you would not have any problems in any case. The one thing to watch out for in FreeRTOS.org is that you always allow the idle task some processing time if you are wanting to delete resources as it is the idle task that does the final clean up. Also, never write an application that uses dynamic memory allocation to allocate and free 'random' sized blocks as this is where you can get into fragmentation problems - but this is true for any embedded system be it FreeRTOS.org based or not.


RE: FreeRTOS - long time stability?

Posted by grunfalan on November 3, 2008
Thanks, very much, to both of you!

That is exactly the answer that I was hoping for.

I already started to play with simple tasks.
It is very exciting - I cant wait to try all the options... Solves easy much of the problems that I have had before...

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

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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

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

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