- NAME
- SYNOPSIS
- FUNCTION DESCRIPTIONS

- MagickAllocFunctions
- MagickMalloc
- MagickCloneMemory
- MagickRealloc
- MagickFree

# NAME

memory - Memory allocation/deallocation functions

# SYNOPSIS

void MagickAllocFunctions( MagickFreeFunc free_func, MagickMallocFunc malloc_func, MagickReallocFunc realloc_func );

void * MagickCloneMemory( void *destination, const void *source, const size_t size );

void * MagickFree( void *memory );

void * MagickMalloc( const size_t size );

void * MagickRealloc( void *memory, const size_t size );

# FUNCTION DESCRIPTIONS

## MagickAllocFunctions

> MagickAllocFunctions() provides a way for the user to supply a preferred free ( ), malloc ( ), and realloc ( ) functions. Otherwise the default system versions are used.

The format of the MagickAllocFunctions method is:

> void MagickAllocFunctions ( MagickFreeFunc free_func, MagickMallocFunc malloc_func, MagickReallocFunc realloc_func );

A description of each parameter follows:

free_func:

  Function to free memory.

malloc_func:

  Function to allocate memory.

realloc_func:

  Function to reallocate memory.

## MagickMalloc

> MagickMalloc() returns a pointer to a block of memory of at least size bytes suitably aligned for any use. NULL is returned if insufficient memory is available or the requested size is zero.

The format of the MagickMalloc method is:

> void *MagickMalloc ( const size_t size );

A description of each parameter follows:

size:

  The size of the memory in bytes to allocate.

## MagickCloneMemory

> MagickCloneMemory() copies size bytes from memory area source to the destination. Copying between objects that overlap will take place correctly. It returns destination.

The format of the MagickCloneMemory method is:

> void *MagickCloneMemory ( void *destination, const void *source, const size_t size );

A description of each parameter follows:

size:

  The size of the memory in bytes to allocate.

## MagickRealloc

> MagickRealloc() changes the size of the memory and returns a pointer to the ( possibly moved ) block. The contents will be unchanged up to the lesser of the new and old sizes. If size is zero, then the memory is freed and a NULL value is returned. If the memory allocation fails, then the existing memory is freed, and a NULL value is returned.

The format of the MagickRealloc method is:

> void *MagickRealloc ( void *memory, const size_t size );

A description of each parameter follows:

memory:

  A pointer to a memory allocation.

size:

  The new size of the allocated memory.

## MagickFree

> MagickFree() frees memory that has already been allocated. A NULL argument is ignored. The function always returns NULL so that the return value may be used to set the memory pointer to null.

The format of the MagickFree method is:

> void *MagickFree ( void *memory );

A description of each parameter follows:

memory:

  A pointer to a block of memory to free for reuse.