1 2 3 4 5 <!DOCTYPE html> 6 <html lang="en"> 7 <head> 8 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" /> 9 <title>ImageMagick: MagickCore, C API for ImageMagick: Memory Allocation</title> 10 <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 11 <meta name="application-name" content="ImageMagick"/> 12 <meta name="description" content="ImageMagick is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bzier curves."/> 13 <meta name="application-url" content="http://www.imagemagick.org"/> 14 <meta name="generator" content="PHP"/> 15 <meta name="keywords" content="magickcore, c, api, for, imagemagick:, memory, allocation, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert"/> 16 <meta name="rating" content="GENERAL"/> 17 <meta name="robots" content="INDEX, FOLLOW"/> 18 <meta name="generator" content="ImageMagick Studio LLC"/> 19 <meta name="author" content="ImageMagick Studio LLC"/> 20 <meta name="revisit-after" content="2 DAYS"/> 21 <meta name="resource-type" content="document"/> 22 <meta name="copyright" content="Copyright (c) 1999-2016 ImageMagick Studio LLC"/> 23 <meta name="distribution" content="Global"/> 24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/> 25 <link rel="icon" href="../image/wand.png"/> 26 <link rel="shortcut icon" href="../image/wand.ico"/> 27 <link rel="stylesheet" href="../css/magick.php"/> 28 </head> 29 <body> 30 <div class="main"> 31 <div class="magick-masthead"> 32 <div class="container"> 33 <script async="async" src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" 34 style="display:block" 35 data-ad-client="ca-pub-3129977114552745" 36 data-ad-slot="6345125851" 37 data-ad-format="auto"></ins> 38 <script> 39 (adsbygoogle = window.adsbygoogle || []).push({}); 40 </script> 41 <nav class="magick-nav"> 42 <a class="magick-nav-item " href="../index.php">Home</a> 43 <a class="magick-nav-item " href="../script/binary-releases.php">Download</a> 44 <a class="magick-nav-item " href="../script/command-line-tools.php">Tools</a> 45 <a class="magick-nav-item " href="../script/command-line-options.php">Options</a> 46 <a class="magick-nav-item " href="../script/resources.php">Resources</a> 47 <a class="magick-nav-item " href="../script/api.php">Develop</a> 48 <a class="magick-nav-item " href="../script/search.php">Search</a> 49 <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a> 50 </nav> 51 </div> 52 </div> 53 <div class="container"> 54 <div class="magick-header"> 55 <p class="text-center"><a href="memory.php#AcquireAlignedMemory">AcquireAlignedMemory</a> • <a href="memory.php#AcquireMagickMemory">AcquireMagickMemory</a> • <a href="memory.php#AcquireQuantumMemory">AcquireQuantumMemory</a> • <a href="memory.php#AcquireVirtualMemory">AcquireVirtualMemory</a> • <a href="memory.php#CopyMagickMemory">CopyMagickMemory</a> • <a href="memory.php#GetMagickMemoryMethods">GetMagickMemoryMethods</a> • <a href="memory.php#GetVirtualMemoryBlob">GetVirtualMemoryBlob</a> • <a href="memory.php#RelinquishAlignedMemory">RelinquishAlignedMemory</a> • <a href="memory.php#RelinquishMagickMemory">RelinquishMagickMemory</a> • <a href="memory.php#RelinquishVirtualMemory">RelinquishVirtualMemory</a> • <a href="memory.php#ResetMagickMemory">ResetMagickMemory</a> • <a href="memory.php#ResizeMagickMemory">ResizeMagickMemory</a> • <a href="memory.php#ResizeQuantumMemory">ResizeQuantumMemory</a> • <a href="memory.php#SetMagickMemoryMethods">SetMagickMemoryMethods</a></p> 56 57 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="AcquireAlignedMemory">AcquireAlignedMemory</a></h2> 58 59 <p>AcquireAlignedMemory() returns a pointer to a block of memory at least size bytes whose address is a multiple of 16*sizeof(void *).</p> 60 61 <p>The format of the AcquireAlignedMemory method is:</p> 62 63 <pre class="text"> 64 void *AcquireAlignedMemory(const size_t count,const size_t quantum) 65 </pre> 66 67 <p>A description of each parameter follows:</p> 68 69 <dd> 70 </dd> 71 72 <dd> </dd> 73 <dl class="dl-horizontal"> 74 <dt>count</dt> 75 <dd>the number of quantum elements to allocate. </dd> 76 77 <dd> </dd> 78 <dt>quantum</dt> 79 <dd>the number of bytes in each quantum. </dd> 80 81 <dd> </dd> 82 </dl> 83 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="AcquireMagickMemory">AcquireMagickMemory</a></h2> 84 85 <p>AcquireMagickMemory() returns a pointer to a block of memory at least size bytes suitably aligned for any use.</p> 86 87 <p>The format of the AcquireMagickMemory method is:</p> 88 89 <pre class="text"> 90 void *AcquireMagickMemory(const size_t size) 91 </pre> 92 93 <p>A description of each parameter follows:</p> 94 95 <dd> 96 </dd> 97 98 <dd> </dd> 99 <dl class="dl-horizontal"> 100 <dt>size</dt> 101 <dd>the size of the memory in bytes to allocate. </dd> 102 103 <dd> </dd> 104 </dl> 105 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="AcquireQuantumMemory">AcquireQuantumMemory</a></h2> 106 107 <p>AcquireQuantumMemory() returns a pointer to a block of memory at least count * quantum bytes suitably aligned for any use.</p> 108 109 <p>The format of the AcquireQuantumMemory method is:</p> 110 111 <pre class="text"> 112 void *AcquireQuantumMemory(const size_t count,const size_t quantum) 113 </pre> 114 115 <p>A description of each parameter follows:</p> 116 117 <dd> 118 </dd> 119 120 <dd> </dd> 121 <dl class="dl-horizontal"> 122 <dt>count</dt> 123 <dd>the number of quantum elements to allocate. </dd> 124 125 <dd> </dd> 126 <dt>quantum</dt> 127 <dd>the number of bytes in each quantum. </dd> 128 129 <dd> </dd> 130 </dl> 131 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="AcquireVirtualMemory">AcquireVirtualMemory</a></h2> 132 133 <p>AcquireVirtualMemory() allocates a pointer to a block of memory at least size bytes suitably aligned for any use.</p> 134 135 <p>The format of the AcquireVirtualMemory method is:</p> 136 137 <pre class="text"> 138 MemoryInfo *AcquireVirtualMemory(const size_t count,const size_t quantum) 139 </pre> 140 141 <p>A description of each parameter follows:</p> 142 143 <dd> 144 </dd> 145 146 <dd> </dd> 147 <dl class="dl-horizontal"> 148 <dt>count</dt> 149 <dd>the number of quantum elements to allocate. </dd> 150 151 <dd> </dd> 152 <dt>quantum</dt> 153 <dd>the number of bytes in each quantum. </dd> 154 155 <dd> </dd> 156 </dl> 157 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="CopyMagickMemory">CopyMagickMemory</a></h2> 158 159 <p>CopyMagickMemory() copies size bytes from memory area source to the destination. Copying between objects that overlap will take place correctly. It returns destination.</p> 160 161 <p>The format of the CopyMagickMemory method is:</p> 162 163 <pre class="text"> 164 void *CopyMagickMemory(void *destination,const void *source, 165 const size_t size) 166 </pre> 167 168 <p>A description of each parameter follows:</p> 169 170 <dd> 171 </dd> 172 173 <dd> </dd> 174 <dl class="dl-horizontal"> 175 <dt>destination</dt> 176 <dd>the destination. </dd> 177 178 <dd> </dd> 179 <dt>source</dt> 180 <dd>the source. </dd> 181 182 <dd> </dd> 183 <dt>size</dt> 184 <dd>the size of the memory in bytes to allocate. </dd> 185 186 <dd> </dd> 187 </dl> 188 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="GetMagickMemoryMethods">GetMagickMemoryMethods</a></h2> 189 190 <p>GetMagickMemoryMethods() gets the methods to acquire, resize, and destroy memory.</p> 191 192 <p>The format of the GetMagickMemoryMethods() method is:</p> 193 194 <pre class="text"> 195 void GetMagickMemoryMethods(AcquireMemoryHandler *acquire_memory_handler, 196 ResizeMemoryHandler *resize_memory_handler, 197 DestroyMemoryHandler *destroy_memory_handler) 198 </pre> 199 200 <p>A description of each parameter follows:</p> 201 202 <dd> 203 </dd> 204 205 <dd> </dd> 206 <dl class="dl-horizontal"> 207 <dt>acquire_memory_handler</dt> 208 <dd>method to acquire memory (e.g. malloc). </dd> 209 210 <dd> </dd> 211 <dt>resize_memory_handler</dt> 212 <dd>method to resize memory (e.g. realloc). </dd> 213 214 <dd> </dd> 215 <dt>destroy_memory_handler</dt> 216 <dd>method to destroy memory (e.g. free). </dd> 217 218 <dd> </dd> 219 </dl> 220 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="GetVirtualMemoryBlob">GetVirtualMemoryBlob</a></h2> 221 222 <p>GetVirtualMemoryBlob() returns the virtual memory blob associated with the specified MemoryInfo structure.</p> 223 224 <p>The format of the GetVirtualMemoryBlob method is:</p> 225 226 <pre class="text"> 227 void *GetVirtualMemoryBlob(const MemoryInfo *memory_info) 228 </pre> 229 230 <p>A description of each parameter follows:</p> 231 232 <dd> 233 </dd> 234 235 <dd> </dd> 236 <dl class="dl-horizontal"> 237 <dt>memory_info</dt> 238 <dd>The MemoryInfo structure. </dd> 239 </dl> 240 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="RelinquishAlignedMemory">RelinquishAlignedMemory</a></h2> 241 242 <p>RelinquishAlignedMemory() frees memory acquired with AcquireAlignedMemory() or reuse.</p> 243 244 <p>The format of the RelinquishAlignedMemory method is:</p> 245 246 <pre class="text"> 247 void *RelinquishAlignedMemory(void *memory) 248 </pre> 249 250 <p>A description of each parameter follows:</p> 251 252 <dd> 253 </dd> 254 255 <dd> </dd> 256 <dl class="dl-horizontal"> 257 <dt>memory</dt> 258 <dd>A pointer to a block of memory to free for reuse. </dd> 259 260 <dd> </dd> 261 </dl> 262 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="RelinquishMagickMemory">RelinquishMagickMemory</a></h2> 263 264 <p>RelinquishMagickMemory() frees memory acquired with AcquireMagickMemory() or AcquireQuantumMemory() for reuse.</p> 265 266 <p>The format of the RelinquishMagickMemory method is:</p> 267 268 <pre class="text"> 269 void *RelinquishMagickMemory(void *memory) 270 </pre> 271 272 <p>A description of each parameter follows:</p> 273 274 <dd> 275 </dd> 276 277 <dd> </dd> 278 <dl class="dl-horizontal"> 279 <dt>memory</dt> 280 <dd>A pointer to a block of memory to free for reuse. </dd> 281 282 <dd> </dd> 283 </dl> 284 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="RelinquishVirtualMemory">RelinquishVirtualMemory</a></h2> 285 286 <p>RelinquishVirtualMemory() frees memory acquired with AcquireVirtualMemory().</p> 287 288 <p>The format of the RelinquishVirtualMemory method is:</p> 289 290 <pre class="text"> 291 MemoryInfo *RelinquishVirtualMemory(MemoryInfo *memory_info) 292 </pre> 293 294 <p>A description of each parameter follows:</p> 295 296 <dd> 297 </dd> 298 299 <dd> </dd> 300 <dl class="dl-horizontal"> 301 <dt>memory_info</dt> 302 <dd>A pointer to a block of memory to free for reuse. </dd> 303 304 <dd> </dd> 305 </dl> 306 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="ResetMagickMemory">ResetMagickMemory</a></h2> 307 308 <p>ResetMagickMemory() fills the first size bytes of the memory area pointed to by memory with the constant byte c.</p> 309 310 <p>The format of the ResetMagickMemory method is:</p> 311 312 <pre class="text"> 313 void *ResetMagickMemory(void *memory,int byte,const size_t size) 314 </pre> 315 316 <p>A description of each parameter follows:</p> 317 318 <dd> 319 </dd> 320 321 <dd> </dd> 322 <dl class="dl-horizontal"> 323 <dt>memory</dt> 324 <dd>a pointer to a memory allocation. </dd> 325 326 <dd> </dd> 327 <dt>byte</dt> 328 <dd>set the memory to this value. </dd> 329 330 <dd> </dd> 331 <dt>size</dt> 332 <dd>size of the memory to reset. </dd> 333 334 <dd> </dd> 335 </dl> 336 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="ResizeMagickMemory">ResizeMagickMemory</a></h2> 337 338 <p>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.</p> 339 340 <p>The format of the ResizeMagickMemory method is:</p> 341 342 <pre class="text"> 343 void *ResizeMagickMemory(void *memory,const size_t size) 344 </pre> 345 346 <p>A description of each parameter follows:</p> 347 348 <dd> 349 </dd> 350 351 <dd> </dd> 352 <dl class="dl-horizontal"> 353 <dt>memory</dt> 354 <dd>A pointer to a memory allocation. </dd> 355 356 <dd> </dd> 357 <dt>size</dt> 358 <dd>the new size of the allocated memory. </dd> 359 360 <dd> </dd> 361 </dl> 362 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="ResizeQuantumMemory">ResizeQuantumMemory</a></h2> 363 364 <p>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.</p> 365 366 <p>The format of the ResizeQuantumMemory method is:</p> 367 368 <pre class="text"> 369 void *ResizeQuantumMemory(void *memory,const size_t count, 370 const size_t quantum) 371 </pre> 372 373 <p>A description of each parameter follows:</p> 374 375 <dd> 376 </dd> 377 378 <dd> </dd> 379 <dl class="dl-horizontal"> 380 <dt>memory</dt> 381 <dd>A pointer to a memory allocation. </dd> 382 383 <dd> </dd> 384 <dt>count</dt> 385 <dd>the number of quantum elements to allocate. </dd> 386 387 <dd> </dd> 388 <dt>quantum</dt> 389 <dd>the number of bytes in each quantum. </dd> 390 391 <dd> </dd> 392 </dl> 393 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/memory_8c.html" id="SetMagickMemoryMethods">SetMagickMemoryMethods</a></h2> 394 395 <p>SetMagickMemoryMethods() sets the methods to acquire, resize, and destroy memory. Your custom memory methods must be set prior to the MagickCoreGenesis() method.</p> 396 397 <p>The format of the SetMagickMemoryMethods() method is:</p> 398 399 <pre class="text"> 400 SetMagickMemoryMethods(AcquireMemoryHandler acquire_memory_handler, 401 ResizeMemoryHandler resize_memory_handler, 402 DestroyMemoryHandler destroy_memory_handler) 403 </pre> 404 405 <p>A description of each parameter follows:</p> 406 407 <dd> 408 </dd> 409 410 <dd> </dd> 411 <dl class="dl-horizontal"> 412 <dt>acquire_memory_handler</dt> 413 <dd>method to acquire memory (e.g. malloc). </dd> 414 415 <dd> </dd> 416 <dt>resize_memory_handler</dt> 417 <dd>method to resize memory (e.g. realloc). </dd> 418 419 <dd> </dd> 420 <dt>destroy_memory_handler</dt> 421 <dd>method to destroy memory (e.g. free). </dd> 422 423 <dd> </dd> 424 </dl> 425 </div> 426 <footer class="magick-footer"> 427 <p><a href="../script/support.php">Donate</a> 428 <a href="../script/sitemap.php">Sitemap</a> 429 <a href="../script/links.php">Related</a> 430 <a href="../script/architecture.php">Architecture</a> 431 </p> 432 <p><a href="memory.php#">Back to top</a> 433 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> 434 <a href="../script/contact.php">Contact Us</a></p> 435 <p><small> 1999-2016 ImageMagick Studio LLC</small></p> 436 </footer> 437 </div><!-- /.container --> 438 439 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 440 <script src="http://nextgen.imagemagick.org/js/magick.php"></script> 441 </div> 442 </body> 443 </html> 444