OpenClovis Logo

API Usage Examples
Heap Management

Code Examples. More...

Code Examples.

Here the allocation and deallocation of the memory is shown. These are very simple operations and very similar to malloc() and free() system calls.

ClRcT retCode = CL_OK;
ClCharT *pStr = NULL;
pStr = (ClCharT*) clHeapAllocate(1024);
if(pStr == NULL)
{
// There is insufficient memory and because of it the memory
// allocation failed.
}
// Now the memory allocate in pStr can be used like a character array.
retCode = clHeapFree(pStr);
if(CL_OK != retCode)
{
// Freeing of the allocated memory failed.
}
// allocated memory is freed successfully.

Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen