From f13205ca32fd17ae65a043cc40f7652097c8dd49 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Fri, 4 Oct 2013 20:56:45 +0000 Subject: [PATCH] Add traceMALLOC() and traceFREE() macros. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2049 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- FreeRTOS/Source/portable/MemMang/heap_1.c | 4 +++- FreeRTOS/Source/portable/MemMang/heap_2.c | 3 +++ FreeRTOS/Source/portable/MemMang/heap_3.c | 2 ++ FreeRTOS/Source/portable/MemMang/heap_4.c | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/FreeRTOS/Source/portable/MemMang/heap_1.c b/FreeRTOS/Source/portable/MemMang/heap_1.c index 1ec4e96b0..2b2d5d625 100644 --- a/FreeRTOS/Source/portable/MemMang/heap_1.c +++ b/FreeRTOS/Source/portable/MemMang/heap_1.c @@ -122,7 +122,9 @@ static unsigned char *pucAlignedHeap = NULL; pvReturn = pucAlignedHeap + xNextFreeByte; xNextFreeByte += xWantedSize; } - } + + traceMALLOC( pvReturn, xWantedSize ); + } xTaskResumeAll(); #if( configUSE_MALLOC_FAILED_HOOK == 1 ) diff --git a/FreeRTOS/Source/portable/MemMang/heap_2.c b/FreeRTOS/Source/portable/MemMang/heap_2.c index ab08b2faa..1aaa63bbf 100644 --- a/FreeRTOS/Source/portable/MemMang/heap_2.c +++ b/FreeRTOS/Source/portable/MemMang/heap_2.c @@ -214,6 +214,8 @@ void *pvReturn = NULL; xFreeBytesRemaining -= pxBlock->xBlockSize; } } + + traceMALLOC( pvReturn, xWantedSize ); } xTaskResumeAll(); @@ -251,6 +253,7 @@ xBlockLink *pxLink; /* Add this block to the list of free blocks. */ prvInsertBlockIntoFreeList( ( ( xBlockLink * ) pxLink ) ); xFreeBytesRemaining += pxLink->xBlockSize; + traceFREE( pv, pxLink->xBlockSize ); } xTaskResumeAll(); } diff --git a/FreeRTOS/Source/portable/MemMang/heap_3.c b/FreeRTOS/Source/portable/MemMang/heap_3.c index b4a0a2fe4..bd6683886 100644 --- a/FreeRTOS/Source/portable/MemMang/heap_3.c +++ b/FreeRTOS/Source/portable/MemMang/heap_3.c @@ -95,6 +95,7 @@ void *pvReturn; vTaskSuspendAll(); { pvReturn = malloc( xWantedSize ); + traceMALLOC( pvReturn, xWantedSize ); } xTaskResumeAll(); @@ -119,6 +120,7 @@ void vPortFree( void *pv ) vTaskSuspendAll(); { free( pv ); + traceFREE( pv, 0 ); } xTaskResumeAll(); } diff --git a/FreeRTOS/Source/portable/MemMang/heap_4.c b/FreeRTOS/Source/portable/MemMang/heap_4.c index 4681ad02f..8de666d0b 100644 --- a/FreeRTOS/Source/portable/MemMang/heap_4.c +++ b/FreeRTOS/Source/portable/MemMang/heap_4.c @@ -229,6 +229,8 @@ void *pvReturn = NULL; } } } + + traceMALLOC( pvReturn, xWantedSize ); } xTaskResumeAll(); @@ -277,6 +279,7 @@ xBlockLink *pxLink; /* Add this block to the list of free blocks. */ xFreeBytesRemaining += pxLink->xBlockSize; prvInsertBlockIntoFreeList( ( ( xBlockLink * ) pxLink ) ); + traceFREE( pv, pxLink->xBlockSize ); } xTaskResumeAll(); } -- 2.39.5