Quality RTOS & Embedded Software

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


Loading

Queue and Memory Management functions

Posted by iporboon on April 11, 2011
Hello

I use the queue functions of freertos to pass the messages among the tasks in the real-time systems. My messages are the groups of data such as arrays or structures. I have to create the queues with the message size of array or structure.

It seems to consume a lot of RAM from my systems. I can not send the pointers to the queues because there is not the dynamic mem alloc in freertos API to use to store the arrays or structures, and I do not want to use malloc function from standard C library because of the real-time predictability problem of that function.

Please suggest the solutions of my problem.
Thank you very much.

RE: Queue and Memory Management functions

Posted by Richard on April 11, 2011
Normally, if you are sending large items of data, you would queue a pointer to the data and the application would have to ensure the data was access correctly (only one task has responsibility for changing the data, only one task for marking the buffer free again once the data is read, etc.).

If you want to send different items on a single queue, then the normal way is to send structures on the queue, with one of the structure members indicating what the queued item actually is, so the receiving task knows how to handle the data.

Regards.

RE: Queue and Memory Management functions

Posted by iporboon on April 11, 2011
I am very sorry if my problem was not clear.

I can not send the pointers to queue because there is not the dynamic mem alloc in freertos API, so I can not get mem blocks to store the data and I do not want to use malloc function of standard C library because of the real-time predictivity problem of that function.

Best regards.

RE: Queue and Memory Management functions

Posted by Dave on April 11, 2011
If your blocks are always the same size then you can use heap_2.c as a dynamic memory allocator without fear of fragmentation. Otherwise, can you use statically declared memory blocks?

RE: Queue and Memory Management functions

Posted by Stephen Cleary on April 11, 2011
If your blocks are the same size, then you can write a very simple pool allocator.

Otherwise, you can write your own (deterministic) memory allocator. I have implemented a modified version of TLSF, and it works quite well so far.


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


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

Latest News

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

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 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.


Careers

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

Renesas

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