]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/portable/MemMang/heap_4.c
Add event_groups.c and associated functions in other core files.
[freertos] / FreeRTOS / Source / portable / MemMang / heap_4.c
index 21a202ee8cb7f5d927da8d288b0ca05772053434..4ed42b8de2d2872ef180b7eff77cd823a808a956 100644 (file)
@@ -134,6 +134,7 @@ static xBlockLink xStart, *pxEnd = NULL;
 /* Keeps track of the number of free bytes remaining, but says nothing about\r
 fragmentation. */\r
 static size_t xFreeBytesRemaining = ( ( size_t ) heapADJUSTED_HEAP_SIZE ) & ( ( size_t ) ~portBYTE_ALIGNMENT_MASK );\r
+static size_t xMinimumEverFreeBytesRemaining = ( ( size_t ) heapADJUSTED_HEAP_SIZE ) & ( ( size_t ) ~portBYTE_ALIGNMENT_MASK );\r
 \r
 /* Gets set to the top bit of an size_t type.  When this bit in the xBlockSize \r
 member of an xBlockLink structure is set then the block belongs to the \r
@@ -223,6 +224,11 @@ void *pvReturn = NULL;
 \r
                                        xFreeBytesRemaining -= pxBlock->xBlockSize;\r
 \r
+                                       if( xFreeBytesRemaining < xMinimumEverFreeBytesRemaining )\r
+                                       {\r
+                                               xMinimumEverFreeBytesRemaining = xFreeBytesRemaining;\r
+                                       }\r
+\r
                                        /* The block is being returned - it is allocated and owned\r
                                        by the application and has no "next" block. */\r
                                        pxBlock->xBlockSize |= xBlockAllocatedBit;\r
@@ -295,6 +301,12 @@ size_t xPortGetFreeHeapSize( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+size_t xPortGetMinimumEverFreeHeapSize( void )\r
+{\r
+       return xMinimumEverFreeBytesRemaining;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
 void vPortInitialiseBlocks( void )\r
 {\r
        /* This just exists to keep the linker quiet. */\r