18#ifndef MAGICKCORE_MEMORY_H
19#define MAGICKCORE_MEMORY_H
23#if defined(__cplusplus) || defined(c_plusplus)
31 *(*AcquireMemoryHandler)(size_t) magick_alloc_size(1),
32 (*DestroyMemoryHandler)(
void *),
33 *(*ResizeMemoryHandler)(
void *,size_t) magick_alloc_size(2),
34 *(*AcquireAlignedMemoryHandler)(
const size_t,
const size_t),
35 (*RelinquishAlignedMemoryHandler)(
void *);
38 *AcquireVirtualMemory(
const size_t,
const size_t) magick_alloc_sizes(1,2),
41extern MagickExport
size_t
42 GetMaxMemoryRequest(
void),
43 GetMaxProfileSize(
void);
45extern MagickExport
void
46 *AcquireAlignedMemory(
const size_t,
const size_t)
47 magick_attribute((__malloc__)) magick_alloc_sizes(1,2),
48 *AcquireMagickMemory(
const size_t) magick_attribute((__malloc__))
50 *AcquireCriticalMemory(
const size_t),
51 *AcquireQuantumMemory(
const size_t,
const size_t)
52 magick_attribute((__malloc__)) magick_alloc_sizes(1,2),
53 *CopyMagickMemory(
void *magick_restrict,
const void *magick_restrict,
54 const size_t) magick_attribute((__nonnull__)),
55 DestroyMagickMemory(
void),
56 GetMagickMemoryMethods(AcquireMemoryHandler *,ResizeMemoryHandler *,
57 DestroyMemoryHandler *),
59 *RelinquishAlignedMemory(
void *),
60 *RelinquishMagickMemory(
void *),
61 *ResetMagickMemory(
void *,
int,
const size_t),
62 *ResizeMagickMemory(
void *,
const size_t)
63 magick_attribute((__malloc__)) magick_alloc_size(2),
64 *ResizeQuantumMemory(
void *,
const size_t,
const size_t)
65 magick_attribute((__malloc__)) magick_alloc_sizes(2,3),
66 SetMagickAlignedMemoryMethods(AcquireAlignedMemoryHandler,
67 RelinquishAlignedMemoryHandler),
68 SetMagickMemoryMethods(AcquireMemoryHandler,ResizeMemoryHandler,
69 DestroyMemoryHandler);
71static inline MagickBooleanType HeapOverflowSanityCheck(
72 const size_t count,
const size_t quantum)
74 if ((count == 0) || (quantum == 0))
76 if (quantum != ((count*quantum)/count))
84static inline MagickBooleanType HeapOverflowSanityCheckGetSize(
85 const size_t count,
const size_t quantum,
size_t *
const extent)
90 if ((count == 0) || (quantum == 0))
93 if (quantum != (length/count))
103#if defined(__cplusplus) || defined(c_plusplus)