Last Updated on : 2024-11-20 08:51:36download
Function name | Description |
---|---|
*Malloc | Request memory allocation. |
Free | Free memory. |
Function prototype
VOID *Malloc(IN SIZE_T reqSize);
Parameters
Parameter name | Parameter type | Description |
---|---|---|
reqSize | IN SIZE_T | The size of the requested memory allocation. |
Return value
Return value | Description |
---|---|
NULL | Memory allocation failed. |
Other | The first address of the allocated memory space. |
Function prototype
VOID Free(IN PVOID_T pReqMem);
Parameters
Parameter name | Parameter type | Description |
---|---|---|
pReqMem | PVOID_T | The first address of the memory space to be freed. |
// After the system initialization is completed, call this interface to test memory allocation.
VOID test_memory()
{
CHAR_T* p = (CHAR_T*)Malloc(100);
if (!p) {
PR_ERR("null point");
return;
}
Free(p);
p = NULL;
}
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback