kupl_free
Unlock and free the memory.
Interface Definition
void kupl_free(kupl_mem_kind_t kind, void *ptr);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
kind |
kupl_mem_kind_t |
Memory allocation policy to be used. |
Input |
ptr |
void* |
Pointer to the memory to be freed. |
Input |
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <stdio.h> #include <stdlib.h> #include "kupl.h" int main() { int len = 1024; char *data = (char *)kupl_malloc(KUPL_MEM_DEFAULT, len); if (data == nullptr) { return 0; } kupl_free(KUPL_MEM_DEFAULT, data); return 0; } |
- The preceding example demonstrates the process of allocating and then freeing the locked memory.
- The kupl_free function unlocks and frees the memory pointed to by data. The default memory allocation policy is used.
- The kupl_free function unlocks if it is locked and frees the memory; otherwise,the memory is directly freed.
Parent topic: Memory Management Functions