Share this page

# free

Memory Allocation Functions

Frees a block of memory allocated on the memory heap by calloc or malloc.

    void free( void *mem_address);

mem_address | The name of the block of memory (array) that is deleted.

## Return Values

There is no return value.

For free details, refer to your C language documentation.

## Example

The following example uses free to de-allocate a buffer of length 1024.

Copy code

        char * buf;
        if ((buf = (char *)calloc(1024, sizeof(char))) == NULL) {
            lr_output_message ("Insufficient memory available");
            return -1;
        }
        lr_output_message ("Memory allocated. Buffer address = %.8x", buf);
        // Do something with the buffer here ...
        // Now free the buffer
        free(buf);

    Example: Output:
    Action.c(11): Memory allocated. Buffer address = 007b9d88

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: