mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
* Heap improvements This commit makes the following improvements: 1. Add a check to heap_2 to track if a memory block is allocated to the application or not. The MSB of the size field is used for this purpose. The same check already exists in heap_4 and heap_5. This check prevents against double free. 2. Add a new flag configHEAP_CLEAR_MEMORY_ON_FREE to heap_2, heap_4 and heap_5. The application writer can set it to 1 in their FreeRTOSConfig.h to ensure that a block of memory allocated using pvPortMalloc is cleared (i.e. set to zero) when it is freed using vPortFree. If left undefined, configHEAP_CLEAR_MEMORY_ON_FREE defaults to 0 for backward compatibility. We recommend setting configHEAP_CLEAR_MEMORY_ON_FREE to 1 for better security. 3. Add a new API pvPortCalloc to heap_2, heap_4 and heap_5. This API has the following signature: void * pvPortCalloc( size_t xNum, size_t xSize ); It allocates memory for an array of xNum objects each of which is of xSize and initializes all bytes in the allocated storage to zero. If allocation succeeds, it returns a pointer to the lowest byte in the allocated memory block. On failure, it returns a null pointer. Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> |
||
---|---|---|
.. | ||
ARMClang | ||
ARMv8M | ||
BCC/16BitDOS | ||
CCS | ||
CodeWarrior | ||
Common | ||
GCC | ||
IAR | ||
Keil | ||
MemMang | ||
MikroC/ARM_CM4F | ||
MPLAB | ||
MSVC-MingW | ||
oWatcom/16BitDOS | ||
Paradigm/Tern_EE | ||
Renesas | ||
Rowley | ||
RVDS | ||
SDCC/Cygnal | ||
Softune | ||
Tasking/ARM_CM4F | ||
ThirdParty | ||
WizC/PIC18 | ||
CMakeLists.txt | ||
readme.txt |
Each real time kernel port consists of three files that contain the core kernel components and are common to every port, and one or more files that are specific to a particular microcontroller and/or compiler. + The FreeRTOS/Source/Portable/MemMang directory contains the five sample memory allocators as described on the https://www.FreeRTOS.org WEB site. + The other directories each contain files specific to a particular microcontroller or compiler, where the directory name denotes the compiler specific files the directory contains. For example, if you are interested in the [compiler] port for the [architecture] microcontroller, then the port specific files are contained in FreeRTOS/Source/Portable/[compiler]/[architecture] directory. If this is the only port you are interested in then all the other directories can be ignored.