1.4.4.14 OSAL_Free Function

C

void OSAL_Free(void* pData)

Summary

Deallocates a block of memory and return to the default pool.

Description

This function deallocates memory and returns it to the default pool. In an RTOS-based application, the memory may have been allocated from multiple pools or simply from the heap. In non-RTOS applications, this function calls the C standard function free.

Precondition

None.

Parameters

ParamDescription
pDataPointer to the memory block to be set free

Returns

None.

Example

// create a working array
uint8_t* pData;

pData = OSAL_Malloc(32);
if (pData != NULL)
{
    ...
    
    // deallocate the memory
    OSAL_Free(pData);
    // and prevent it accidentally being used again
    pData = NULL;
}

Remarks

None.