| 1 | <?xml version="1.0" encoding="UTF-8"?> |
|---|
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
|---|
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> |
|---|
| 4 | <head> |
|---|
| 5 | <style type="text/css"><!-- |
|---|
| 6 | @import url("../../www/wizard.css"); |
|---|
| 7 | //--></style> |
|---|
| 8 | <title>Wizard's Toolkit: C API for the Wizard's Toolkit: Memory Allocation/Deallocation</title> |
|---|
| 9 | <meta http-equiv="Content-Language" content="en-US"/> |
|---|
| 10 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
|---|
| 11 | <meta http-equiv="Reply-to" content="magick-users@imagemagick.org"/> |
|---|
| 12 | <meta name="Generator" content="PHP"/> |
|---|
| 13 | <meta name="Keywords" content="c, api, for, the, wizard's, toolkit:, memory, allocation/deallocation, WizardsToolkit, Wizard's, Toolkit"/> |
|---|
| 14 | <meta name="Description" content="The Wizard's Toolkit, version 1.0.2, is a free C API that includes a number of methods most developers will find useful in their projects."/> |
|---|
| 15 | <meta name="Rating" content="INDEX, FOLLOW"/> |
|---|
| 16 | <meta name="Robots" content="ALL"/> |
|---|
| 17 | <meta name="Generator" content="ImageMagick Studio LLC"/> |
|---|
| 18 | <meta name="Author" content="ImageMagick Studio LLC"/> |
|---|
| 19 | <meta name="Revisit-after" content="2 DAYS"/> |
|---|
| 20 | <meta name="Resource-type" content="document"/> |
|---|
| 21 | <meta name="Copyright" content="Copyright (c) 1999-2009 ImageMagick Studio LLC"/> |
|---|
| 22 | <meta name="Distribution" content="Global"/> |
|---|
| 23 | <link rel="shortcut icon" href="../../images/wand.ico" type="images/vnd.microsoft.icon"/> |
|---|
| 24 | </head> |
|---|
| 25 | |
|---|
| 26 | <body id="www-wizards-toolkit.org"> |
|---|
| 27 | <table id="titlebar" style="width: 100%;background-color: #f5f5f5" cellpadding="0" cellspacing="0" border="0" summary="Wizard's Toolkit"> |
|---|
| 28 | <tbody> |
|---|
| 29 | <tr valign="top"> |
|---|
| 30 | <td align="left"><a href="../../index.html"><img id="titlebar-west" src="../../images/script.png" alt="[Wizard's Toolkit]" width="400" height="60" border="0" vspace="28" name="titlebar-west" /></a></td> |
|---|
| 31 | <td align="left"><a href="http://www.wizards-toolkit.org/" target="603879436"><img id="titlebar-west" src="../../images/sponsor.jpg" alt="[sponsor]" border="0" vspace="28" name="titlebar-west" /></a></td> |
|---|
| 32 | <td width="99%"><br /></td> |
|---|
| 33 | <td style="background-color: white" align="right"><a href="../../index.html"><img src="../../images/sprite.jpg" alt="" width="114" height="118" border="0" name="titlebar-east" /></a></td> |
|---|
| 34 | <td style="background-color: white" align="right"><a href="http://www.wizards-toolkit.org/discourse-server/viewforum.html?f=17" target="1670722430"><img id="titlebar-east" src="../../images/logo.jpg" alt="" width="114" height="118" border="0" name="titlebar-east" /></a></td> |
|---|
| 35 | </tr> |
|---|
| 36 | </tbody> |
|---|
| 37 | </table> |
|---|
| 38 | |
|---|
| 39 | <table style="width: 100%" border="0" cellpadding="0" cellspacing="0" summary=""> |
|---|
| 40 | <tbody> |
|---|
| 41 | |
|---|
| 42 | <tr valign="top" style="height: 100%;"> |
|---|
| 43 | <td id="menu" width="1%" height="100%"> |
|---|
| 44 | <p><a href="#main">Skip to page contents</a></p> |
|---|
| 45 | <font size="-1"> |
|---|
| 46 | <span>[</span> |
|---|
| 47 | <a href="../../index.html">About the<br />Wizard's Toolkit</a> |
|---|
| 48 | <span>]</span><br /><span>[</span> |
|---|
| 49 | <a href="../../www/command-line-tools.html">Command-line Tools</a> |
|---|
| 50 | <span>]</span><br /><span>[</span> |
|---|
| 51 | <a href="../../www/api.html">Application Program<br />Interface</a> |
|---|
| 52 | <span>]</span><br /><span>[</span> |
|---|
| 53 | <a href="../../www/install-source.html">Install from Source</a> |
|---|
| 54 | <a href="../../www/install-source.html#unix" class="sub">Unix</a> |
|---|
| 55 | <a href="../../www/install-source.html#windows" class="sub">Windows</a> |
|---|
| 56 | <a href="../../www/binary-releases.html">Binary Releases</a> |
|---|
| 57 | <a href="../../www/binary-releases.html#unix" class="sub">Unix</a> |
|---|
| 58 | <a href="../../www/binary-releases.html#windows" class="sub">Windows</a> |
|---|
| 59 | <span>]</span><br /><span>[</span> |
|---|
| 60 | <a href="../../www/download.html">Download</a> |
|---|
| 61 | <span>]</span><br /><span>[</span> |
|---|
| 62 | <div class="menu"> |
|---|
| 63 | <a href="../../www/sponsors.html">Sponsors:</a> |
|---|
| 64 | |
|---|
| 65 | <div class="sponsbox"> |
|---|
| 66 | <div class="sponsor"> |
|---|
| 67 | <a href="http://www.tomsgutscheine.de">Tom's Gutscheine</a><!-- 201005010360 invendio.de--> |
|---|
| 68 | </div> |
|---|
| 69 | </div> |
|---|
| 70 | </div> |
|---|
| 71 | <span>]</span> |
|---|
| 72 | </font> |
|---|
| 73 | </td> |
|---|
| 74 | |
|---|
| 75 | <td id="main" valign="top"> |
|---|
| 76 | <p class="navigation-index">[<a href="#AcquireAlignedMemory">AcquireAlignedMemory</a> • <a href="#AcquireWizardMemory">AcquireWizardMemory</a> • <a href="#AcquireQuantumMemory">AcquireQuantumMemory</a> • <a href="#CopyWizardMemory">CopyWizardMemory</a> • <a href="#GetWizardMemoryMethods">GetWizardMemoryMethods</a> • <a href="#RelinquishAlignedMemory">RelinquishAlignedMemory</a> • <a href="#RelinquishWizardMemory">RelinquishWizardMemory</a> • <a href="#ResetWizardMemory">ResetWizardMemory</a> • <a href="#ResizeWizardMemory">ResizeWizardMemory</a> • <a href="#ResizeQuantumMemory">ResizeQuantumMemory</a> • <a href="#SetWizardMemoryMethods">SetWizardMemoryMethods</a>]</p> |
|---|
| 77 | |
|---|
| 78 | <h2><a href="http://www.wizards-toolkit.org/api/WizardsToolkit/memory |
|---|
| 79 | _8c.html" target="source" name="AcquireAlignedMemory">AcquireAlignedMemory</a></h2> |
|---|
| 80 | <div class="doc-section"> |
|---|
| 81 | |
|---|
| 82 | <p>AcquireAlignedMemory() returns a pointer to a block of memory at least size bytes whose address is a multiple of 16*sizeof(void *).</p></ol> |
|---|
| 83 | |
|---|
| 84 | <p>The format of the AcquireAlignedMemory method is:</p> |
|---|
| 85 | |
|---|
| 86 | <pre class="code"> |
|---|
| 87 | void *AcquireAlignedMemory(const size_t count,const size_t quantum) |
|---|
| 88 | </pre> |
|---|
| 89 | |
|---|
| 90 | <p>A description of each parameter follows:</p></ol> |
|---|
| 91 | |
|---|
| 92 | <h5>count</h5> |
|---|
| 93 | <ol><p>the number of quantum elements to allocate.</p></ol> |
|---|
| 94 | |
|---|
| 95 | <h5>quantum</h5> |
|---|
| 96 | <ol><p>the number of bytes in each quantum.</p></ol> |
|---|
| 97 | |
|---|
| 98 | </div> |
|---|
| 99 | <h2><a href="http://www.wizards-toolkit.org/api/WizardsToolkit/memory |
|---|
| 100 | _8c.html" target="source" name="AcquireWizardMemory">AcquireWizardMemory</a></h2> |
|---|
| 101 | <div class="doc-section"> |
|---|
| 102 | |
|---|
| 103 | <p>AcquireWizardMemory() returns a pointer to a block of memory at least size bytes suitably aligned for any use.</p></ol> |
|---|
| 104 | |
|---|
| 105 | <p>The format of the AcquireWizardMemory method is:</p> |
|---|
| 106 | |
|---|
| 107 | <pre class="code"> |
|---|
| 108 | void *AcquireWizardMemory(const size_t size) |
|---|
| 109 | </pre> |
|---|
| 110 | |
|---|
| 111 | <p>A description of each parameter follows:</p></ol> |
|---|
| 112 | |
|---|
| 113 | <h5>size</h5> |
|---|
| 114 | <ol><p>the size of the memory in bytes to allocate.</p></ol> |
|---|
| 115 | |
|---|
| 116 | </div> |
|---|
| 117 | <h2><a href="http://www.wizards-toolkit.org/api/WizardsToolkit/memory |
|---|
| 118 | _8c.html" target="source" name="AcquireQuantumMemory">AcquireQuantumMemory</a></h2> |
|---|
| 119 | <div class="doc-section"> |
|---|
| 120 | |
|---|
| 121 | <p>AcquireQuantumMemory() returns a pointer to a block of memory at least count * quantum bytes suitably aligned for any use.</p></ol> |
|---|
| 122 | |
|---|
| 123 | <p>The format of the AcquireQuantumMemory method is:</p> |
|---|
| 124 | |
|---|
| 125 | <pre class="code"> |
|---|
| 126 | void *AcquireQuantumMemory(const size_t count,const size_t quantum) |
|---|
| 127 | </pre> |
|---|
| 128 | |
|---|
| 129 | <p>A description of each parameter follows:</p></ol> |
|---|
| 130 | |
|---|
| 131 | <h5>count</h5> |
|---|
| 132 | <ol><p>the number of quantum elements to allocate.</p></ol> |
|---|
| 133 | |
|---|
| 134 | <h5>quantum</h5> |
|---|
| 135 | <ol><p>the number of bytes in each quantum.</p></ol> |
|---|
| 136 | |
|---|
| 137 | </div> |
|---|
| 138 | <h2><a href="http://www.wizards-toolkit.org/api/WizardsToolkit/memory |
|---|
| 139 | _8c.html" target="source" name="CopyWizardMemory">CopyWizardMemory</a></h2> |
|---|
| 140 | <div class="doc-section"> |
|---|
| 141 | |
|---|
| 142 | <p>CopyWizardMemory() copies size bytes from memory area source to the destination. Copying between objects that overlap will take place correctly. It returns destination.</p></ol> |
|---|
| 143 | |
|---|
| 144 | <p>The format of the CopyWizardMemory method is:</p> |
|---|
| 145 | |
|---|
| 146 | <pre class="code"> |
|---|
| 147 | void *CopyWizardMemory(void *destination,const void *source, |
|---|
| 148 | const size_t size) |
|---|
| 149 | </pre> |
|---|
| 150 | |
|---|
| 151 | <p>A description of each parameter follows:</p></ol> |
|---|
| 152 | |
|---|
| 153 | <h5>destination</h5> |
|---|
| 154 | <ol><p>the destination.</p></ol> |
|---|
| 155 | |
|---|
| 156 | <h5>source</h5> |
|---|
| 157 | <ol><p>the source.</p></ol> |
|---|
| 158 | |
|---|
| 159 | <h5>size</h5> |
|---|
| 160 | <ol><p>the size of the memory in bytes to allocate.</p></ol> |
|---|
| 161 | |
|---|
| 162 | </div> |
|---|
| 163 | <h2><a href="http://www.wizards-toolkit.org/api/WizardsToolkit/memory |
|---|
| 164 | _8c.html" target="source" name="GetWizardMemoryMethods">GetWizardMemoryMethods</a></h2> |
|---|
| 165 | <div class="doc-section"> |
|---|
| 166 | |
|---|
| 167 | <p>GetWizardMemoryMethods() gets the methods to acquire, resize, and destroy memory.</p></ol> |
|---|
| 168 | |
|---|
| 169 | <p>The format of the GetWizardMemoryMethods() method is:</p> |
|---|
| 170 | |
|---|
| 171 | <pre class="code"> |
|---|
| 172 | void GetWizardMemoryMethods(AcquireMemoryHandler *acquire_memory_handler, |
|---|
| 173 | ResizeMemoryHandler *resize_memory_handler, |
|---|
| 174 | DestroyMemoryHandler *destroy_memory_handler) |
|---|
| 175 | </pre> |
|---|
| 176 | |
|---|
| 177 | <p>A description of each parameter follows:</p></ol> |
|---|
| 178 | |
|---|
| 179 | <h5>acquire_memory_handler</h5> |
|---|
| 180 | <ol><p>method to acquire memory (e.g. malloc).</p></ol> |
|---|
| 181 | |
|---|
| 182 | <h5>resize_memory_handler</h5> |
|---|
| 183 | <ol><p>method to resize memory (e.g. realloc).</p></ol> |
|---|
| 184 | |
|---|
| 185 | <h5>destroy_memory_handler</h5> |
|---|
| 186 | <ol><p>method to destroy memory (e.g. free).</p></ol> |
|---|
| 187 | |
|---|
| 188 | </div> |
|---|
| 189 | <h2><a href="http://www.wizards-toolkit.org/api/WizardsToolkit/memory |
|---|
| 190 | _8c.html" target="source" name="RelinquishAlignedMemory">RelinquishAlignedMemory</a></h2> |
|---|
| 191 | <div class="doc-section"> |
|---|
| 192 | |
|---|
| 193 | <p>RelinquishAlignedMemory() frees memory acquired with AcquireAlignedMemory() or reuse.</p></ol> |
|---|
| 194 | |
|---|
| 195 | <p>The format of the RelinquishAlignedMemory method is:</p> |
|---|
| 196 | |
|---|
| 197 | <pre class="code"> |
|---|
| 198 | void *RelinquishAlignedMemory(void *memory) |
|---|
| 199 | </pre> |
|---|
| 200 | |
|---|
| 201 | <p>A description of each parameter follows:</p></ol> |
|---|
| 202 | |
|---|
| 203 | <h5>memory</h5> |
|---|
| 204 | <ol><p>A pointer to a block of memory to free for reuse.</p></ol> |
|---|
| 205 | |
|---|
| 206 | </div> |
|---|
| 207 | <h2><a href="http://www.wizards-toolkit.org/api/WizardsToolkit/memory |
|---|
| 208 | _8c.html" target="source" name="RelinquishWizardMemory">RelinquishWizardMemory</a></h2> |
|---|
| 209 | <div class="doc-section"> |
|---|
| 210 | |
|---|
| 211 | <p>RelinquishWizardMemory() zeros memory that has been allocated, frees it for reuse.</p></ol> |
|---|
| 212 | |
|---|
| 213 | <p>The format of the RelinquishWizardMemory method is:</p> |
|---|
| 214 | |
|---|
| 215 | <pre class="code"> |
|---|
| 216 | void *RelinquishWizardMemory(void *memory) |
|---|
| 217 | </pre> |
|---|
| 218 | |
|---|
| 219 | <p>A description of each parameter follows:</p></ol> |
|---|
| 220 | |
|---|
| 221 | <h5>memory</h5> |
|---|
| 222 | <ol><p>A pointer to a block of memory to free for reuse.</p></ol> |
|---|
| 223 | |
|---|
| 224 | </div> |
|---|
| 225 | <h2><a href="http://www.wizards-toolkit.org/api/WizardsToolkit/memory |
|---|
| 226 | _8c.html" target="source" name="ResetWizardMemory">ResetWizardMemory</a></h2> |
|---|
| 227 | <div class="doc-section"> |
|---|
| 228 | |
|---|
| 229 | <p>ResetWizardMemory() fills the first size bytes of the memory area pointed to by memory with the constant byte c.</p></ol> |
|---|
| 230 | |
|---|
| 231 | <p>The format of the ResetWizardMemory method is:</p> |
|---|
| 232 | |
|---|
| 233 | <pre class="code"> |
|---|
| 234 | void *ResetWizardMemory(void *memory,int byte,const size_t size) |
|---|
| 235 | </pre> |
|---|
| 236 | |
|---|
| 237 | <p>A description of each parameter follows:</p></ol> |
|---|
| 238 | |
|---|
| 239 | <h5>memory</h5> |
|---|
| 240 | <ol><p>A pointer to a memory allocation.</p></ol> |
|---|
| 241 | |
|---|
| 242 | <h5>byte</h5> |
|---|
| 243 | <ol><p>Set the memory to this value.</p></ol> |
|---|
| 244 | |
|---|
| 245 | <h5>size</h5> |
|---|
| 246 | <ol><p>Size of the memory to reset.</p></ol> |
|---|
| 247 | |
|---|
| 248 | </div> |
|---|
| 249 | <h2><a href="http://www.wizards-toolkit.org/api/WizardsToolkit/memory |
|---|
| 250 | _8c.html" target="source" name="ResizeWizardMemory">ResizeWizardMemory</a></h2> |
|---|
| 251 | <div class="doc-section"> |
|---|
| 252 | |
|---|
| 253 | <p>ResizeWizardMemory() 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></ol> |
|---|
| 254 | |
|---|
| 255 | <p>The format of the ResizeWizardMemory method is:</p> |
|---|
| 256 | |
|---|
| 257 | <pre class="code"> |
|---|
| 258 | void *ResizeWizardMemory(void *memory,const size_t size) |
|---|
| 259 | </pre> |
|---|
| 260 | |
|---|
| 261 | <p>A description of each parameter follows:</p></ol> |
|---|
| 262 | |
|---|
| 263 | <h5>memory</h5> |
|---|
| 264 | <ol><p>A pointer to a memory allocation.</p></ol> |
|---|
| 265 | |
|---|
| 266 | <h5>size</h5> |
|---|
| 267 | <ol><p>the new size of the allocated memory.</p></ol> |
|---|
| 268 | |
|---|
| 269 | </div> |
|---|
| 270 | <h2><a href="http://www.wizards-toolkit.org/api/WizardsToolkit/memory |
|---|
| 271 | _8c.html" target="source" name="ResizeQuantumMemory">ResizeQuantumMemory</a></h2> |
|---|
| 272 | <div class="doc-section"> |
|---|
| 273 | |
|---|
| 274 | <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></ol> |
|---|
| 275 | |
|---|
| 276 | <p>The format of the ResizeQuantumMemory method is:</p> |
|---|
| 277 | |
|---|
| 278 | <pre class="code"> |
|---|
| 279 | void *ResizeQuantumMemory(void *memory,const size_t count, |
|---|
| 280 | const size_t quantum) |
|---|
| 281 | </pre> |
|---|
| 282 | |
|---|
| 283 | <p>A description of each parameter follows:</p></ol> |
|---|
| 284 | |
|---|
| 285 | <h5>memory</h5> |
|---|
| 286 | <ol><p>A pointer to a memory allocation.</p></ol> |
|---|
| 287 | |
|---|
| 288 | <h5>count</h5> |
|---|
| 289 | <ol><p>the number of quantum elements to allocate.</p></ol> |
|---|
| 290 | |
|---|
| 291 | <h5>quantum</h5> |
|---|
| 292 | <ol><p>the number of bytes in each quantum.</p></ol> |
|---|
| 293 | |
|---|
| 294 | </div> |
|---|
| 295 | <h2><a href="http://www.wizards-toolkit.org/api/WizardsToolkit/memory |
|---|
| 296 | _8c.html" target="source" name="SetWizardMemoryMethods">SetWizardMemoryMethods</a></h2> |
|---|
| 297 | <div class="doc-section"> |
|---|
| 298 | |
|---|
| 299 | <p>SetWizardMemoryMethods() sets the methods to acquire, resize, and destroy memory.</p></ol> |
|---|
| 300 | |
|---|
| 301 | <p>The format of the SetWizardMemoryMethods() method is:</p> |
|---|
| 302 | |
|---|
| 303 | <pre class="code"> |
|---|
| 304 | SetWizardMemoryMethods(AcquireMemoryHandler acquire_memory_handler, |
|---|
| 305 | ResizeMemoryHandler resize_memory_handler, |
|---|
| 306 | DestroyMemoryHandler destroy_memory_handler) |
|---|
| 307 | </pre> |
|---|
| 308 | |
|---|
| 309 | <p>A description of each parameter follows:</p></ol> |
|---|
| 310 | |
|---|
| 311 | <h5>acquire_memory_handler</h5> |
|---|
| 312 | <ol><p>method to acquire memory (e.g. malloc).</p></ol> |
|---|
| 313 | |
|---|
| 314 | <h5>resize_memory_handler</h5> |
|---|
| 315 | <ol><p>method to resize memory (e.g. realloc).</p></ol> |
|---|
| 316 | |
|---|
| 317 | <h5>destroy_memory_handler</h5> |
|---|
| 318 | <ol><p>method to destroy memory (e.g. free).</p></ol> |
|---|
| 319 | |
|---|
| 320 | </div> |
|---|
| 321 | </td> |
|---|
| 322 | <td id="margin" width="1%" height="100%" valign="top" align="right"> </td> |
|---|
| 323 | </tr> |
|---|
| 324 | </tbody> |
|---|
| 325 | </table> |
|---|
| 326 | <div id="linkbar"> |
|---|
| 327 | <a href="http://www.wizards-toolkit.org/discourse-server/viewforum.html?f=17" target="1798280429">Discourse Server</a> | |
|---|
| 328 | <a href="../../www/license.html">License</a> | |
|---|
| 329 | <a href="../../www/notice.html">Notice</a> |
|---|
| 330 | </div> |
|---|
| 331 | <div id="footer"> |
|---|
| 332 | <span id="footer-west">© 1999-2009 ImageMagick Studio LLC</span> |
|---|
| 333 | </div> |
|---|
| 334 | <div style="clear: both; margin: 0; width: 100%; "></div> |
|---|
| 335 | </body> |
|---|
| 336 | </html> |
|---|