1.4.4.14 OSAL_Free Function

1.4.4.14 C

void OSAL_Free(void* pData)

1.4.4.14 Summary

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

1.4.4.14 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.

1.4.4.14 Precondition

None.

1.4.4.14 Parameters

ParametersDescription
pDataPointer to the memory block to be set free

1.4.4.14 Returns

None.

1.4.4.14 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;
}

1.4.4.14 Remarks

None.