ImageMagick: MagickCore, C API for ImageMagick: Memory Allocation
Author: ImageMagick Studio LLC
Description: ImageMagick is a software suite to create, edit, compose, or convert bitmap images in a variety of formats. Use ImageMagick to scale, rotate, shear, distort and transform images.
Keywords: magickcore, c, api, for, imagemagick:, memory, allocation, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand, ImageMagickObject, Swiss, Army, Knife, Image, Processing

Unix
Mac OS X
Windows
Processing
Options
Usage
MagickWand
MagickCore
PerlMagick
Magick++
Unix
Windows
Links

# Module memory Methods

## AcquireAlignedMemory

AcquireAlignedMemory() returns a pointer to a block of memory at least size bytes whose address is a multiple of 16*sizeof(void *).

The format of the AcquireAlignedMemory method is:

      void *AcquireAlignedMemory(const size_t count,const size_t quantum)

A description of each parameter follows:

##### count

the number of quantum elements to allocate.

##### quantum

the number of bytes in each quantum.

## AcquireMagickMemory

AcquireMagickMemory() returns a pointer to a block of memory at least size bytes suitably aligned for any use.

The format of the AcquireMagickMemory method is:

      void *AcquireMagickMemory(const size_t size)

A description of each parameter follows:

##### size

the size of the memory in bytes to allocate.

## AcquireQuantumMemory

AcquireQuantumMemory() returns a pointer to a block of memory at least count * quantum bytes suitably aligned for any use.

The format of the AcquireQuantumMemory method is:

      void *AcquireQuantumMemory(const size_t count,const size_t quantum)

A description of each parameter follows:

##### count

the number of quantum elements to allocate.

##### quantum

the number of bytes in each quantum.

## CopyMagickMemory

CopyMagickMemory() 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 CopyMagickMemory method is:

      void *CopyMagickMemory(void *destination,const void *source,
        const size_t size)

A description of each parameter follows:

##### destination

the destination.

##### source

the source.

##### size

the size of the memory in bytes to allocate.

## GetMagickMemoryMethods

GetMagickMemoryMethods() gets the methods to acquire, resize, and destroy memory.

The format of the GetMagickMemoryMethods() method is:

      void GetMagickMemoryMethods(AcquireMemoryHandler *acquire_memory_handler,
        ResizeMemoryHandler *resize_memory_handler,
        DestroyMemoryHandler *destroy_memory_handler)

A description of each parameter follows:

##### acquire_memory_handler

method to acquire memory (e.g. malloc).

##### resize_memory_handler

method to resize memory (e.g. realloc).

##### destroy_memory_handler

method to destroy memory (e.g. free).

## RelinquishAlignedMemory

RelinquishAlignedMemory() frees memory acquired with AcquireAlignedMemory() or reuse.

The format of the RelinquishAlignedMemory method is:

      void *RelinquishAlignedMemory(void *memory)

A description of each parameter follows:

##### memory

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

## RelinquishMagickMemory

RelinquishMagickMemory() frees memory acquired with AcquireMagickMemory() or AcquireQuantumMemory() for reuse.

The format of the RelinquishMagickMemory method is:

      void *RelinquishMagickMemory(void *memory)

A description of each parameter follows:

##### memory

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

## ResetMagickMemory

ResetMagickMemory() fills the first size bytes of the memory area pointed to by memory with the constant byte c.

The format of the ResetMagickMemory method is:

      void *ResetMagickMemory(void *memory,int byte,const size_t size)

A description of each parameter follows:

##### memory

A pointer to a memory allocation.

##### byte

Set the memory to this value.

##### size

Size of the memory to reset.

## ResizeMagickMemory

ResizeMagickMemory() 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.

The format of the ResizeMagickMemory method is:

      void *ResizeMagickMemory(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.

## ResizeQuantumMemory

ResizeQuantumMemory() 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.

The format of the ResizeQuantumMemory method is:

      void *ResizeQuantumMemory(void *memory,const size_t count,
        const size_t quantum)

A description of each parameter follows:

##### memory

A pointer to a memory allocation.

##### count

the number of quantum elements to allocate.

##### quantum

the number of bytes in each quantum.

## SetMagickMemoryMethods

SetMagickMemoryMethods() sets the methods to acquire, resize, and destroy memory.

The format of the SetMagickMemoryMethods() method is:

      SetMagickMemoryMethods(AcquireMemoryHandler acquire_memory_handler,
        ResizeMemoryHandler resize_memory_handler,
        DestroyMemoryHandler destroy_memory_handler)

A description of each parameter follows:

##### acquire_memory_handler

method to acquire memory (e.g. malloc).

##### resize_memory_handler

method to resize memory (e.g. realloc).

##### destroy_memory_handler

method to destroy memory (e.g. free).

Discourse Server • Studio