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] [April 2007 Threads] malloc/free thread & interrupt-safePosted by Joe on April 9, 2007 Hi @all,
I am using the arm7-gcc port of FreeRTOS with the Aeolus-newlib syscall-stub with some modifications and it works fine. But now I have a question concerning the malloc/free-mechanism during interrupts. At the moment i also use the heap_3.c module which uses the standard-malloc/free because I do not have hard deterministic requirements. But I unsure if this malloc/free (sbrk_r) also works during interrupts and if it is thread safe. Does anyone know more about my requirements or does someone have a solution for my question ?
regards Joe
RE: malloc/free thread & interrupt-safePosted by Nobody/Anonymous on April 9, 2007 You cannot use pvPortMalloc or vPortFree from an interrupt because they use critical sections to ensure they are thread safe. You could use standard malloc and free from an interrupt, provided you only use the thread safe versions from outside of the interrupt.
However, generally it would be considered bad practice to call such a potentially large and non deterministic function such as malloc from within an interrupt in any case.
Dave.
RE: malloc/free thread & interrupt-safePosted by Joe on April 9, 2007 Ok, I will check another way to implement my requirements. You have right with the statement of bad practise, may be i will check the possiblity using preallocated blocks
Joe
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|