• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2
3
4
5<!DOCTYPE html>
6<html lang="en">
7<head>
8  <meta charset="utf-8"  />
9  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no"  />
10  <title>MagickCore, C API: Memory Allocation @ ImageMagick</title>
11  <meta name="application-name" content="ImageMagick" />
12  <meta name="description" content="Use ImageMagick® to create, edit, compose, or convert bitmap images. You can resize your image, crop it, change its shades and colors, add captions, among other operations." />
13  <meta name="application-url" content="https://imagemagick.org" />
14  <meta name="generator" content="PHP" />
15  <meta name="keywords" content="magickcore, c, api:, 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-2019 ImageMagick Studio LLC" />
23  <meta name="distribution" content="Global" />
24  <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" />
25  <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
26  <link href="memory.html" rel="canonical" />
27  <link href="../../images/wand.png" rel="icon" />
28  <link href="../../images/wand.ico" rel="shortcut icon" />
29  <link href="../assets/magick.css" rel="stylesheet" />
30</head>
31<body>
32  <header>
33  <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
34    <a class="navbar-brand" href="../../"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../../images/wand.ico"/></a>
35    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation">
36      <span class="navbar-toggler-icon"></span>
37    </button>
38
39    <div class="navbar-collapse collapse" id="navbarsMagick" style="">
40    <ul class="navbar-nav mr-auto">
41      <li class="nav-item ">
42        <a class="nav-link" href="quantize.html">Home <span class="sr-only">(current)</span></a>
43      </li>
44      <li class="nav-item ">
45        <a class="nav-link" href="../../www/download.html">Download</a>
46      </li>
47      <li class="nav-item ">
48        <a class="nav-link" href="../../www/command-line-tools.html">Tools</a>
49      </li>
50      <li class="nav-item ">
51        <a class="nav-link" href="../../www/command-line-processing.html">Command-line</a>
52      </li>
53      <li class="nav-item ">
54        <a class="nav-link" href="../../www/resources.html">Resources</a>
55      </li>
56      <li class="nav-item ">
57        <a class="nav-link" href="../../www/develop.html">Develop</a>
58      </li>
59      <li class="nav-item">
60        <a class="nav-link" target="_blank" href="https://imagemagick.org/discourse-server/">Community</a>
61      </li>
62    </ul>
63    <form class="form-inline my-2 my-lg-0" action="https://imagemagick.org/script/search.php">
64      <input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search">
65      <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button>
66    </form>
67    </div>
68  </nav>
69  <div class="container">
70   <script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
71         style="display:block"
72         data-ad-client="ca-pub-3129977114552745"
73         data-ad-slot="6345125851"
74         data-ad-format="auto"></ins>
75    <script>
76      (adsbygoogle = window.adsbygoogle || []).push({});
77    </script>
78
79  </div>
80  </header>
81  <main class="container">
82    <div class="magick-template">
83<div class="magick-header">
84<p class="text-center"><a href="memory.html#AcquireAlignedMemory">AcquireAlignedMemory</a> &#8226; <a href="memory.html#AcquireMagickMemory">AcquireMagickMemory</a> &#8226; <a href="memory.html#AcquireQuantumMemory">AcquireQuantumMemory</a> &#8226; <a href="memory.html#AcquireVirtualMemory">AcquireVirtualMemory</a> &#8226; <a href="memory.html#CopyMagickMemory">CopyMagickMemory</a> &#8226; <a href="memory.html#GetMagickMemoryMethods">GetMagickMemoryMethods</a> &#8226; <a href="memory.html#GetVirtualMemoryBlob">GetVirtualMemoryBlob</a> &#8226; <a href="memory.html#RelinquishAlignedMemory">RelinquishAlignedMemory</a> &#8226; <a href="memory.html#RelinquishMagickMemory">RelinquishMagickMemory</a> &#8226; <a href="memory.html#RelinquishVirtualMemory">RelinquishVirtualMemory</a> &#8226; <a href="memory.html#ResetMagickMemory">ResetMagickMemory</a> &#8226; <a href="memory.html#ResizeMagickMemory">ResizeMagickMemory</a> &#8226; <a href="memory.html#ResizeQuantumMemory">ResizeQuantumMemory</a> &#8226; <a href="memory.html#SetMagickMemoryMethods">SetMagickMemoryMethods</a></p>
85
86<h2><a href="../../api/MagickCore/memory_8c.html" id="AcquireAlignedMemory">AcquireAlignedMemory</a></h2>
87
88<p>AcquireAlignedMemory() returns a pointer to a block of memory at least size bytes whose address is aligned on a cache line or page boundary.</p>
89
90<p>The format of the AcquireAlignedMemory method is:</p>
91
92<pre class="text">
93void *AcquireAlignedMemory(const size_t count,const size_t quantum)
94</pre>
95
96<p>A description of each parameter follows:</p>
97
98<dd>
99</dd>
100
101<dd> </dd>
102<dl class="dl-horizontal">
103<dt>count</dt>
104<dd>the number of quantum elements to allocate. </dd>
105
106<dd> </dd>
107<dt>quantum</dt>
108<dd>the number of bytes in each quantum. </dd>
109
110<dd>  </dd>
111</dl>
112<h2><a href="../../api/MagickCore/memory_8c.html" id="AcquireMagickMemory">AcquireMagickMemory</a></h2>
113
114<p>AcquireMagickMemory() returns a pointer to a block of memory at least size bytes suitably aligned for any use.</p>
115
116<p>The format of the AcquireMagickMemory method is:</p>
117
118<pre class="text">
119void *AcquireMagickMemory(const size_t size)
120</pre>
121
122<p>A description of each parameter follows:</p>
123
124<dd>
125</dd>
126
127<dd> </dd>
128<dl class="dl-horizontal">
129<dt>size</dt>
130<dd>the size of the memory in bytes to allocate. </dd>
131
132<dd>  </dd>
133</dl>
134<h2><a href="../../api/MagickCore/memory_8c.html" id="AcquireQuantumMemory">AcquireQuantumMemory</a></h2>
135
136<p>AcquireQuantumMemory() returns a pointer to a block of memory at least count * quantum bytes suitably aligned for any use.</p>
137
138<p>The format of the AcquireQuantumMemory method is:</p>
139
140<pre class="text">
141void *AcquireQuantumMemory(const size_t count,const size_t quantum)
142</pre>
143
144<p>A description of each parameter follows:</p>
145
146<dd>
147</dd>
148
149<dd> </dd>
150<dl class="dl-horizontal">
151<dt>count</dt>
152<dd>the number of quantum elements to allocate. </dd>
153
154<dd> </dd>
155<dt>quantum</dt>
156<dd>the number of bytes in each quantum. </dd>
157
158<dd>  </dd>
159</dl>
160<h2><a href="../../api/MagickCore/memory_8c.html" id="AcquireVirtualMemory">AcquireVirtualMemory</a></h2>
161
162<p>AcquireVirtualMemory() allocates a pointer to a block of memory at least size bytes suitably aligned for any use. In addition to heap, it also supports memory-mapped and file-based memory-mapped memory requests.</p>
163
164<p>The format of the AcquireVirtualMemory method is:</p>
165
166<pre class="text">
167MemoryInfo *AcquireVirtualMemory(const size_t count,const size_t quantum)
168</pre>
169
170<p>A description of each parameter follows:</p>
171
172<dd>
173</dd>
174
175<dd> </dd>
176<dl class="dl-horizontal">
177<dt>count</dt>
178<dd>the number of quantum elements to allocate. </dd>
179
180<dd> </dd>
181<dt>quantum</dt>
182<dd>the number of bytes in each quantum. </dd>
183
184<dd>  </dd>
185</dl>
186<h2><a href="../../api/MagickCore/memory_8c.html" id="CopyMagickMemory">CopyMagickMemory</a></h2>
187
188<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>
189
190<p>The format of the CopyMagickMemory method is:</p>
191
192<pre class="text">
193void *CopyMagickMemory(void *destination,const void *source,
194  const size_t size)
195</pre>
196
197<p>A description of each parameter follows:</p>
198
199<dd>
200</dd>
201
202<dd> </dd>
203<dl class="dl-horizontal">
204<dt>destination</dt>
205<dd>the destination. </dd>
206
207<dd> </dd>
208<dt>source</dt>
209<dd>the source. </dd>
210
211<dd> </dd>
212<dt>size</dt>
213<dd>the size of the memory in bytes to allocate. </dd>
214
215<dd>  </dd>
216</dl>
217<h2><a href="../../api/MagickCore/memory_8c.html" id="GetMagickMemoryMethods">GetMagickMemoryMethods</a></h2>
218
219<p>GetMagickMemoryMethods() gets the methods to acquire, resize, and destroy memory.</p>
220
221<p>The format of the GetMagickMemoryMethods() method is:</p>
222
223<pre class="text">
224void GetMagickMemoryMethods(AcquireMemoryHandler *acquire_memory_handler,
225  ResizeMemoryHandler *resize_memory_handler,
226  DestroyMemoryHandler *destroy_memory_handler)
227</pre>
228
229<p>A description of each parameter follows:</p>
230
231<dd>
232</dd>
233
234<dd> </dd>
235<dl class="dl-horizontal">
236<dt>acquire_memory_handler</dt>
237<dd>method to acquire memory (e.g. malloc). </dd>
238
239<dd> </dd>
240<dt>resize_memory_handler</dt>
241<dd>method to resize memory (e.g. realloc). </dd>
242
243<dd> </dd>
244<dt>destroy_memory_handler</dt>
245<dd>method to destroy memory (e.g. free). </dd>
246
247<dd>  </dd>
248</dl>
249<h2><a href="../../api/MagickCore/memory_8c.html" id="GetVirtualMemoryBlob">GetVirtualMemoryBlob</a></h2>
250
251<p>GetVirtualMemoryBlob() returns the virtual memory blob associated with the specified MemoryInfo structure.</p>
252
253<p>The format of the GetVirtualMemoryBlob method is:</p>
254
255<pre class="text">
256void *GetVirtualMemoryBlob(const MemoryInfo *memory_info)
257</pre>
258
259<p>A description of each parameter follows:</p>
260
261<dd>
262</dd>
263
264<dd> </dd>
265<dl class="dl-horizontal">
266<dt>memory_info</dt>
267<dd>The MemoryInfo structure.  </dd>
268</dl>
269<h2><a href="../../api/MagickCore/memory_8c.html" id="RelinquishAlignedMemory">RelinquishAlignedMemory</a></h2>
270
271<p>RelinquishAlignedMemory() frees memory acquired with AcquireAlignedMemory() or reuse.</p>
272
273<p>The format of the RelinquishAlignedMemory method is:</p>
274
275<pre class="text">
276void *RelinquishAlignedMemory(void *memory)
277</pre>
278
279<p>A description of each parameter follows:</p>
280
281<dd>
282</dd>
283
284<dd> </dd>
285<dl class="dl-horizontal">
286<dt>memory</dt>
287<dd>A pointer to a block of memory to free for reuse. </dd>
288
289<dd>  </dd>
290</dl>
291<h2><a href="../../api/MagickCore/memory_8c.html" id="RelinquishMagickMemory">RelinquishMagickMemory</a></h2>
292
293<p>RelinquishMagickMemory() frees memory acquired with AcquireMagickMemory() or AcquireQuantumMemory() for reuse.</p>
294
295<p>The format of the RelinquishMagickMemory method is:</p>
296
297<pre class="text">
298void *RelinquishMagickMemory(void *memory)
299</pre>
300
301<p>A description of each parameter follows:</p>
302
303<dd>
304</dd>
305
306<dd> </dd>
307<dl class="dl-horizontal">
308<dt>memory</dt>
309<dd>A pointer to a block of memory to free for reuse. </dd>
310
311<dd>  </dd>
312</dl>
313<h2><a href="../../api/MagickCore/memory_8c.html" id="RelinquishVirtualMemory">RelinquishVirtualMemory</a></h2>
314
315<p>RelinquishVirtualMemory() frees memory acquired with AcquireVirtualMemory().</p>
316
317<p>The format of the RelinquishVirtualMemory method is:</p>
318
319<pre class="text">
320MemoryInfo *RelinquishVirtualMemory(MemoryInfo *memory_info)
321</pre>
322
323<p>A description of each parameter follows:</p>
324
325<dd>
326</dd>
327
328<dd> </dd>
329<dl class="dl-horizontal">
330<dt>memory_info</dt>
331<dd>A pointer to a block of memory to free for reuse. </dd>
332
333<dd>  </dd>
334</dl>
335<h2><a href="../../api/MagickCore/memory_8c.html" id="ResetMagickMemory">ResetMagickMemory</a></h2>
336
337<p>ResetMagickMemory() fills the first size bytes of the memory area pointed to by memory with the constant byte c.</p>
338
339<p>The format of the ResetMagickMemory method is:</p>
340
341<pre class="text">
342void *ResetMagickMemory(void *memory,int byte,const size_t size)
343</pre>
344
345<p>A description of each parameter follows:</p>
346
347<dd>
348</dd>
349
350<dd> </dd>
351<dl class="dl-horizontal">
352<dt>memory</dt>
353<dd>a pointer to a memory allocation. </dd>
354
355<dd> </dd>
356<dt>byte</dt>
357<dd>set the memory to this value. </dd>
358
359<dd> </dd>
360<dt>size</dt>
361<dd>size of the memory to reset. </dd>
362
363<dd>  </dd>
364</dl>
365<h2><a href="../../api/MagickCore/memory_8c.html" id="ResizeMagickMemory">ResizeMagickMemory</a></h2>
366
367<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>
368
369<p>The format of the ResizeMagickMemory method is:</p>
370
371<pre class="text">
372void *ResizeMagickMemory(void *memory,const size_t size)
373</pre>
374
375<p>A description of each parameter follows:</p>
376
377<dd>
378</dd>
379
380<dd> </dd>
381<dl class="dl-horizontal">
382<dt>memory</dt>
383<dd>A pointer to a memory allocation. </dd>
384
385<dd> </dd>
386<dt>size</dt>
387<dd>the new size of the allocated memory. </dd>
388
389<dd>  </dd>
390</dl>
391<h2><a href="../../api/MagickCore/memory_8c.html" id="ResizeQuantumMemory">ResizeQuantumMemory</a></h2>
392
393<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>
394
395<p>The format of the ResizeQuantumMemory method is:</p>
396
397<pre class="text">
398void *ResizeQuantumMemory(void *memory,const size_t count,
399  const size_t quantum)
400</pre>
401
402<p>A description of each parameter follows:</p>
403
404<dd>
405</dd>
406
407<dd> </dd>
408<dl class="dl-horizontal">
409<dt>memory</dt>
410<dd>A pointer to a memory allocation. </dd>
411
412<dd> </dd>
413<dt>count</dt>
414<dd>the number of quantum elements to allocate. </dd>
415
416<dd> </dd>
417<dt>quantum</dt>
418<dd>the number of bytes in each quantum. </dd>
419
420<dd>  </dd>
421</dl>
422<h2><a href="../../api/MagickCore/memory_8c.html" id="SetMagickMemoryMethods">SetMagickMemoryMethods</a></h2>
423
424<p>SetMagickMemoryMethods() sets the methods to acquire, resize, and destroy memory. Your custom memory methods must be set prior to the MagickCoreGenesis() method.</p>
425
426<p>The format of the SetMagickMemoryMethods() method is:</p>
427
428<pre class="text">
429SetMagickMemoryMethods(AcquireMemoryHandler acquire_memory_handler,
430  ResizeMemoryHandler resize_memory_handler,
431  DestroyMemoryHandler destroy_memory_handler)
432</pre>
433
434<p>A description of each parameter follows:</p>
435
436<dd>
437</dd>
438
439<dd> </dd>
440<dl class="dl-horizontal">
441<dt>acquire_memory_handler</dt>
442<dd>method to acquire memory (e.g. malloc). </dd>
443
444<dd> </dd>
445<dt>resize_memory_handler</dt>
446<dd>method to resize memory (e.g. realloc). </dd>
447
448<dd> </dd>
449<dt>destroy_memory_handler</dt>
450<dd>method to destroy memory (e.g. free). </dd>
451
452<dd>  </dd>
453</dl>
454</div>
455    </div>
456  </main><!-- /.container -->
457  <footer class="magick-footer">
458    <p><a href="../../www/security-policy.html">Security</a> •
459    <a href="../../www/architecture.html">Architecture</a> •
460    <a href="../../www/links.html">Related</a> •
461     <a href="../../www/sitemap.html">Sitemap</a>
462
463    <a href="memory.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../../images/wand.ico"/></a>
464
465    <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
466    <a href="../../www/support.html">Donate</a> •
467    <a href="../../www/contact.html">Contact Us</a>
468    <br/>
469    <small>© 1999-2019 ImageMagick Studio LLC</small></p>
470  </footer>
471
472  <!-- Javascript assets -->
473  <script src="../assets/magick.js" crossorigin="anonymous"></script>
474  <script>window.jQuery || document.write('<script src="https://localhost/ajax/libs/jquery/3.3.1/jquery.min.js"><\/script>')</script>
475</body>
476</html>
477<!-- Magick Cache 3rd January 2019 18:57 -->