Home | History | Annotate | Download | only in MagickCore

Lines Matching defs:memory

13 %                     MagickCore Memory Allocation Methods                    %
36 % Segregate our memory requirements from any program that calls our API. This
38 % memory corruption.
40 % Our custom memory allocation manager implements a best-fit allocation policy
43 % sizes. It is based on the paper, "Fast Memory Allocation using Lazy Fits."
46 % By default, ANSI memory methods are called (e.g. malloc). Use the
47 % custom memory allocator by defining MAGICKCORE_ANONYMOUS_MEMORY_SUPPORT
48 % to allocate memory with private anonymous mapping rather than from the
63 #include "MagickCore/memory-private.h"
228 % AcquireAlignedMemory() returns a pointer to a block of memory at least size
253 *memory;
257 memory=NULL;
264 if (posix_memalign(&memory,alignment,extent) != 0)
265 memory=NULL;
267 memory=_aligned_malloc(extent,alignment);
279 memory=(void *) AlignedExtent((size_t) p+sizeof(void *),alignment);
280 *((void **) memory-1)=p;
285 return(memory);
301 % AcquireBlock() returns a pointer to a block of memory at least size bytes
310 % o size: the size of the memory in bytes to allocate.
450 % AcquireMagickMemory() returns a pointer to a block of memory at least size
459 % o size: the size of the memory in bytes to allocate.
465 *memory;
468 memory=memory_methods.acquire_memory_handler(size == 0 ? 1UL : size);
497 memory=AcquireBlock(size == 0 ? 1UL : size);
498 if (memory == (void *) NULL)
501 memory=AcquireBlock(size == 0 ? 1UL : size);
505 return(memory);
520 % AcquireQuantumMemory() returns a pointer to a block of memory at least
557 % AcquireVirtualMemory() allocates a pointer to a block of memory at least size
603 Heap memory failed, try anonymous memory mapping.
617 Anonymous memory mapping failed, try file-backed memory mapping.
619 file-backed memory mapping.
640 File-backed memory mapping failed, delete the temporary file.
673 % CopyMagickMemory() copies size bytes from memory area source to the
688 % o size: the size of the memory in bytes to allocate.
733 % DestroyMagickMemory() deallocates memory associated with the memory manager.
776 % ExpandHeap() get more memory from the system. It returns MagickTrue on
785 % o size: the size of the memory in bytes we require.
853 % memory.
863 % o acquire_memory_handler: method to acquire memory (e.g. malloc).
865 % o resize_memory_handler: method to resize memory (e.g. realloc).
867 % o destroy_memory_handler: method to destroy memory (e.g. free).
895 % GetVirtualMemoryBlob() returns the virtual memory blob associated with the
935 % o size: the size of the memory in bytes we require.
965 % RelinquishAlignedMemory() frees memory acquired with AcquireAlignedMemory()
970 % void *RelinquishAlignedMemory(void *memory)
974 % o memory: A pointer to a block of memory to free for reuse.
977 memory)
979 if (memory == (void *) NULL)
982 free(memory);
984 _aligned_free(memory);
986 free(*((void **) memory-1));
1003 % RelinquishMagickMemory() frees memory acquired with AcquireMagickMemory()
1008 % void *RelinquishMagickMemory(void *memory)
1012 % o memory: A pointer to a block of memory to free for reuse.
1015 MagickExport void *RelinquishMagickMemory(void *memory)
1017 if (memory == (void *) NULL)
1020 memory_methods.destroy_memory_handler(memory);
1023 assert((SizeOfBlock(memory) % (4*sizeof(size_t))) == 0);
1024 assert((*BlockHeader(NextBlock(memory)) & PreviousBlockBit) != 0);
1025 if ((*BlockHeader(memory) & PreviousBlockBit) == 0)
1033 previous=PreviousBlock(memory);
1035 *BlockHeader(previous)=(SizeOfBlock(previous)+SizeOfBlock(memory)) |
1037 memory=previous;
1039 if ((*BlockHeader(NextBlock(NextBlock(memory))) & PreviousBlockBit) == 0)
1047 next=NextBlock(memory);
1049 *BlockHeader(memory)=(SizeOfBlock(memory)+SizeOfBlock(next)) |
1050 (*BlockHeader(memory) & ~SizeMask);
1052 *BlockFooter(memory,SizeOfBlock(memory))=SizeOfBlock(memory);
1053 *BlockHeader(NextBlock(memory))&=(~PreviousBlockBit);
1054 InsertFreeBlock(memory,AllocationPolicy(SizeOfBlock(memory)));
1072 % RelinquishVirtualMemory() frees memory acquired with AcquireVirtualMemory().
1080 % o memory_info: A pointer to a block of memory to free for reuse.
1132 % ResetMagickMemory() fills the first size bytes of the memory area pointed to
1133 % by memory with the constant byte c.
1137 % void *ResetMagickMemory(void *memory,int byte,const size_t size)
1141 % o memory: a pointer to a memory allocation.
1143 % o byte: set the memory to this value.
1145 % o size: size of the memory to reset.
1148 MagickExport void *ResetMagickMemory(void *memory,int byte,const size_t size)
1150 assert(memory != (void *) NULL);
1151 return(memset(memory,byte,size));
1166 % ResizeMagickMemory() changes the size of the memory and returns a pointer to
1172 % void *ResizeMagickMemory(void *memory,const size_t size)
1176 % o memory: A pointer to a memory allocation.
1178 % o size: the new size of the allocated memory.
1186 *memory;
1190 memory=AcquireBlock(size);
1191 if (memory == (void *) NULL)
1194 (void) memcpy(memory,block,size);
1196 (void) memcpy(memory,block,SizeOfBlock(block)-sizeof(size_t));
1198 return(memory);
1202 MagickExport void *ResizeMagickMemory(void *memory,const size_t size)
1207 if (memory == (void *) NULL)
1210 block=memory_methods.resize_memory_handler(memory,size == 0 ? 1UL : size);
1212 memory=RelinquishMagickMemory(memory);
1215 block=ResizeBlock(memory,size == 0 ? 1UL : size);
1221 memory=RelinquishMagickMemory(memory);
1224 block=ResizeBlock(memory,size == 0 ? 1UL : size);
1228 memory=RelinquishMagickMemory(memory);
1245 % ResizeQuantumMemory() changes the size of the memory and returns a pointer
1251 % void *ResizeQuantumMemory(void *memory,const size_t count,
1256 % o memory: A pointer to a memory allocation.
1263 MagickExport void *ResizeQuantumMemory(void *memory,const size_t count,
1271 memory=RelinquishMagickMemory(memory);
1275 return(ResizeMagickMemory(memory,extent));
1291 % memory. Your custom memory methods must be set prior to the
1302 % o acquire_memory_handler: method to acquire memory (e.g. malloc).
1304 % o resize_memory_handler: method to resize memory (e.g. realloc).
1306 % o destroy_memory_handler: method to destroy memory (e.g. free).
1315 Set memory methods.