IAR Embedded Workbench for MSP430 (and, I would guess, other IAR products) has an option “Enable thread support in library”. If this is ticked, the library puts locks around calls to malloc() and free() to give thread safety. The developer is responsible for implementing four functions to implement the locking (see http://supp.iar.com/FilesPublic/UPDINFO/005691/arm/doc/infocenter/DLIBThreadSupport.html). When using this with FreeRTOS, it seems to be sufficient that locking calls vTaskSuspendAll() and unlocking calls xTaskResumeAll() (similar to what heap_3.c does).
However, that means that FreeRTOS’s pvPortMalloc() and vPortFree() in heap_3.c do the lock and unlock twice - once in heap_3.c and once in the IAR library. I’m not sure what the overhead of this is, or if there are any adverse effects (I doubt that there are). But it’s fairly trivial to avoid.
I’ve modified FreeRTOS.h to add a new config option configLOCK_MALLOC_FREE which causes the duplicate calls to be omitted. I then set that in FreeRTOSConfig.h to 1. Then I wrapped the calls in heap_3.c in #if’s so that they get omitted.
The attached files are diffs against FreeRTOS 7.6.0 to implement this, together with a sample file locking.c that can be added to the project to implement the locking.