memory - Memory allocation/deallocation functions
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 );
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:
Function to free memory.
Function to allocate memory.
Function to reallocate memory.
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:
The size of the memory in bytes to allocate.
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:
The size of the memory in bytes to allocate.
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:
A pointer to a memory allocation.
The new size of the allocated memory.
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:
A pointer to a block of memory to free for reuse.