Fix traceMALLOC() memory count is inaccurate. (#1078)

Modify xWantedSize to the size of a free block when not split blocks.

Ensure that the sizes within traceMALLOC() and traceFREE() macros are equal.
This commit is contained in:
WangGaoJie 2024-06-11 09:38:27 +08:00
parent e64d1e06b3
commit 2d5c193a0f
14 changed files with 59 additions and 13 deletions

View file

@ -360,7 +360,7 @@ void * pvPortMalloc( size_t xWantedSize )
}
else
{
mtCOVERAGE_TEST_MARKER();
xWantedSize = pxBlock->xBlockSize;
}
xFreeBytesRemaining -= pxBlock->xBlockSize;
@ -396,6 +396,9 @@ void * pvPortMalloc( size_t xWantedSize )
traceMALLOC( pvReturn, xWantedSize );
/* Prevent compiler warnings when trace macros are not used. */
( void ) xWantedSize;
#if ( secureconfigUSE_MALLOC_FAILED_HOOK == 1 )
{
if( pvReturn == NULL )