mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-07 13:45:00 -05:00
Revert "Remove useless alignment calculations and increase heap usage size"
This reverts commit 7832a4bc11.
This commit is contained in:
parent
7832a4bc11
commit
4c04d2485a
2 changed files with 12 additions and 6 deletions
|
|
@ -50,6 +50,9 @@
|
|||
#error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0
|
||||
#endif
|
||||
|
||||
/* A few bytes might be lost to byte aligning the heap start address. */
|
||||
#define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT )
|
||||
|
||||
/* Allocate the memory for the heap. */
|
||||
#if ( configAPPLICATION_ALLOCATED_HEAP == 1 )
|
||||
|
||||
|
|
@ -90,7 +93,7 @@ void * pvPortMalloc( size_t xWantedSize )
|
|||
|
||||
/* Check there is enough room left for the allocation and. */
|
||||
if( ( xWantedSize > 0 ) && /* valid size */
|
||||
( ( xNextFreeByte + xWantedSize ) < configTOTAL_HEAP_SIZE )) /* check for overflow */
|
||||
( ( xNextFreeByte + xWantedSize ) < configADJUSTED_HEAP_SIZE )) /* check for overflow */
|
||||
{
|
||||
/* Return the next free byte then increment the index past this
|
||||
* block. */
|
||||
|
|
@ -136,7 +139,7 @@ void vPortInitialiseBlocks( void )
|
|||
|
||||
size_t xPortGetFreeHeapSize( void )
|
||||
{
|
||||
return( configTOTAL_HEAP_SIZE - xNextFreeByte );
|
||||
return( configADJUSTED_HEAP_SIZE - xNextFreeByte );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue