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] [July 2008 Threads] Stack memory Defragmentation ?Posted by Sachin Bhujbal on July 25, 2008 Dear All, I have one doubt about TaskCreate() & TaskDelete() functions. As per FreeRTOs source code when a task deletes, the memory block used by it is listed in a link list. When we creates a task, it first checks the available free blocks, checks the sizes of them & it uses those free blocks only if any block is having large size than required for that task. In this case there will be memory loss. Is there any Defragmentation available in FreeRTOs ? If anybody have any idea, please reply. Thanks, Sachin Bhujbal
RE: Stack memory Defragmentation ?Posted by Dave on July 25, 2008 FreeRTOS uses pvPortMalloc and vPortFree instead of malloc and free. This means you can define whichever memory allocation scheme you want. If you are using heap_2.c and the tasks you create and delete always have the same stack size and there is no other random size memory allocation going on then you should not suffer from fragmentation as the same memory blocks will just get reused.
RE: Stack memory Defragmentation ?Posted by Sachin Bhujbal on July 25, 2008 Dave, Thanks for the Reply, You have suggested a best thing, for small applications. But it is not possible to keep same stack size for all tasks in big applications because of RAM limitations.
RE: Stack memory Defragmentation ?Posted by Sachin Bhujbal on August 11, 2008 Dear Dave, What we will do is we kept two or three fixed stack sizes, high, medium, low. And we will fit all the tasks in that three stack sizes as per requirement. So this is also benificial. Thanks for giving the clue of solution, Thank You Very Much.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|