@@ -187,10 +187,10 @@ PRIVILEGED_DATA static BlockLink_t * pxEnd = NULL;
187187
188188/* Keeps track of the number of calls to allocate and free memory as well as the
189189 * number of free bytes remaining, but says nothing about fragmentation. */
190- PRIVILEGED_DATA static size_t xFreeBytesRemaining = 0U ;
191- PRIVILEGED_DATA static size_t xMinimumEverFreeBytesRemaining = 0U ;
192- PRIVILEGED_DATA static size_t xNumberOfSuccessfulAllocations = 0 ;
193- PRIVILEGED_DATA static size_t xNumberOfSuccessfulFrees = 0 ;
190+ PRIVILEGED_DATA static size_t xFreeBytesRemaining = ( size_t ) 0U ;
191+ PRIVILEGED_DATA static size_t xMinimumEverFreeBytesRemaining = ( size_t ) 0U ;
192+ PRIVILEGED_DATA static size_t xNumberOfSuccessfulAllocations = ( size_t ) 0U ;
193+ PRIVILEGED_DATA static size_t xNumberOfSuccessfulFrees = ( size_t ) 0U ;
194194
195195#if ( configENABLE_HEAP_PROTECTOR == 1 )
196196
@@ -707,3 +707,24 @@ void vPortGetHeapStats( HeapStats_t * pxHeapStats )
707707 taskEXIT_CRITICAL ();
708708}
709709/*-----------------------------------------------------------*/
710+
711+ /*
712+ * Reset the state in this file. This state is normally initialized at start up.
713+ * This function must be called by the application before restarting the
714+ * scheduler.
715+ */
716+ void vPortHeapResetState ( void )
717+ {
718+ pxEnd = NULL ;
719+
720+ xFreeBytesRemaining = ( size_t ) 0U ;
721+ xMinimumEverFreeBytesRemaining = ( size_t ) 0U ;
722+ xNumberOfSuccessfulAllocations = ( size_t ) 0U ;
723+ xNumberOfSuccessfulFrees = ( size_t ) 0U ;
724+
725+ #if ( configENABLE_HEAP_PROTECTOR == 1 )
726+ pucHeapHighAddress = NULL ;
727+ pucHeapLowAddress = NULL ;
728+ #endif /* #if ( configENABLE_HEAP_PROTECTOR == 1 ) */
729+ }
730+ /*-----------------------------------------------------------*/
0 commit comments