FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [January 2009 Threads] Stack Memory Defragmentation - heap_2.cPosted by fkln on January 28, 2009 Are there any workarounds concering the problem of the Memory Defragmentation of the heap ?
My idea is, during vPortFree() look at the following block and the previous block in the list of free blocks. If any or both blocks are free, it should be possible to combine the free blocks to one common free block.
With this solution, the defragmentation should be avoided ?
Any comments ?
Klaus
RE: Stack Memory Defragmentation - heap_2.cPosted by Dave on January 28, 2009 It is common for heap managers to combine adjacent free blocks. This reduces but does not remove fragmentation problems. It generally also makes the functions slower and less deterministic.
RE: Stack Memory Defragmentation - heap_2.cPosted by fkln on January 28, 2009 Are there any add-ons for FreeRTOS for such a heap manager ?
Klaus
RE: Stack Memory Defragmentation - heap_2.cPosted by Raphael Derosso Pereira on January 28, 2009 It mainly depend on your development environment. For example, if you use GCC and newlib, you could use its malloc() and free() implementation, that already take care of that.
RE: Stack Memory Defragmentation - heap_2.cPosted by incrediball on January 28, 2009 If the defragmenting would be done by something optional in the idle task, the speed of the operation shouldn't be a concern, unless a significant amount of time is spent inside critical sections.
To the person who suggested malloc/free: how useful is that really for embedded systems? malloc just seems a bit too general purpose for me with no way of configuring it, i.e. total heap size, minimum/maximum block size, where is any housekeeping done, what are worst and best case conditions, etc. I actually wound up writing my own heap manager because I wanted something handle based that would allow blocks to be relocated and reference counted.
RE: Stack Memory Defragmentation - heap_2.cPosted by fkln on January 29, 2009 Thanks for the replies. I think, the solution with the defragmentation in the idle task is the best solution. Is a source code for this solution available ?
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|