11db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<?xml version="1.0" encoding="UTF-8"?> 21db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<html> 31db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <head> 41db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 51db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <title>xmlmemory: interface for the memory allocator</title> 61db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <meta name="generator" content="Libxml2 devhelp stylesheet"/> 71db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <link rel="start" href="index.html" title="libxml2 Reference Manual"/> 81db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <link rel="up" href="general.html" title="API"/> 91db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <link rel="stylesheet" href="style.css" type="text/css"/> 101db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <link rel="chapter" href="general.html" title="API"/> 111db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </head> 121db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 131db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> 141db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <tr valign="middle"> 151db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <td> 161db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <a accesskey="p" href="libxml2-xmlexports.html"> 171db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <img src="left.png" width="24" height="24" border="0" alt="Prev"/> 181db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </a> 191db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </td> 201db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <td> 211db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <a accesskey="u" href="general.html"> 221db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <img src="up.png" width="24" height="24" border="0" alt="Up"/> 231db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </a> 241db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </td> 251db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <td> 261db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <a accesskey="h" href="index.html"> 271db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <img src="home.png" width="24" height="24" border="0" alt="Home"/> 281db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </a> 291db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </td> 301db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <td> 311db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <a accesskey="n" href="libxml2-xmlmodule.html"> 321db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <img src="right.png" width="24" height="24" border="0" alt="Next"/> 331db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </a> 341db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </td> 351db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <th width="100%" align="center">libxml2 Reference Manual</th> 361db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </tr> 371db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </table> 381db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <h2> 391db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <span class="refentrytitle">xmlmemory</span> 401db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </h2> 411db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <p>xmlmemory - interface for the memory allocator</p> 421db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <p>provides interfaces for the memory allocator, including debugging capabilities. </p> 431db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <p>Author(s): Daniel Veillard </p> 441db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsynopsisdiv"> 451db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <h2>Synopsis</h2> 461db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <pre class="synopsis">#define <a href="#xmlRealloc">xmlRealloc</a>; 471db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard#define <a href="#xmlMalloc">xmlMalloc</a>; 481db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard#define <a href="#xmlMallocAtomic">xmlMallocAtomic</a>; 491db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard#define <a href="#DEBUG_MEMORY">DEBUG_MEMORY</a>; 501db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard#define <a href="#xmlMemStrdup">xmlMemStrdup</a>; 511db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardvoid * <a href="#xmlMemRealloc">xmlMemRealloc</a> (void * ptr, <br/> size_t size); 521db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardint <a href="#xmlInitMemory">xmlInitMemory</a> (void); 531db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardvoid <a href="#xmlMemFree">xmlMemFree</a> (void * ptr); 541db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardvoid * <a href="#xmlMemMalloc">xmlMemMalloc</a> (size_t size); 552cba415895e2cf9a15567038151009869b6c52a7Daniel Veillardvoid <a href="#xmlMemDisplayLast">xmlMemDisplayLast</a> (FILE * fp, <br/> long nbBytes); 561db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardint <a href="#xmlMemGet">xmlMemGet</a> (<a href="libxml2-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> * freeFunc, <br/> <a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> * mallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> * reallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> * strdupFunc); 571db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardvoid <a href="#xmlMemoryDump">xmlMemoryDump</a> (void); 581db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardvoid * <a href="#xmlMallocLoc">xmlMallocLoc</a> (size_t size, <br/> const char * file, <br/> int line); 591db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardvoid <a href="#xmlMemDisplay">xmlMemDisplay</a> (FILE * fp); 601db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardint <a href="#xmlMemBlocks">xmlMemBlocks</a> (void); 611db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardint <a href="#xmlGcMemGet">xmlGcMemGet</a> (<a href="libxml2-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> * freeFunc, <br/> <a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> * mallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> * mallocAtomicFunc, <br/> <a href="libxml2-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> * reallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> * strdupFunc); 621db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardtypedef char * <a href="#xmlStrdupFunc">xmlStrdupFunc</a> (const char * str); 631db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardtypedef void <a href="#xmlFreeFunc">xmlFreeFunc</a> (void * mem); 641db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardvoid <a href="#xmlMemShow">xmlMemShow</a> (FILE * fp, <br/> int nr); 651db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardvoid * <a href="#xmlMallocAtomicLoc">xmlMallocAtomicLoc</a> (size_t size, <br/> const char * file, <br/> int line); 661db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardvoid * <a href="#xmlReallocLoc">xmlReallocLoc</a> (void * ptr, <br/> size_t size, <br/> const char * file, <br/> int line); 671db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardvoid <a href="#xmlCleanupMemory">xmlCleanupMemory</a> (void); 681db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardint <a href="#xmlMemUsed">xmlMemUsed</a> (void); 691db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardint <a href="#xmlMemSetup">xmlMemSetup</a> (<a href="libxml2-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> freeFunc, <br/> <a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> mallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> reallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> strdupFunc); 701db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardtypedef void * <a href="#xmlReallocFunc">xmlReallocFunc</a> (void * mem, <br/> size_t size); 711db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardtypedef void * <a href="#xmlMallocFunc">xmlMallocFunc</a> (size_t size); 721db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardint <a href="#xmlGcMemSetup">xmlGcMemSetup</a> (<a href="libxml2-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> freeFunc, <br/> <a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> mallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> mallocAtomicFunc, <br/> <a href="libxml2-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> reallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> strdupFunc); 731db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardchar * <a href="#xmlMemoryStrdup">xmlMemoryStrdup</a> (const char * str); 741db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillardchar * <a href="#xmlMemStrdupLoc">xmlMemStrdupLoc</a> (const char * str, <br/> const char * file, <br/> int line); 751db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre> 761db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </div> 771db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect1" lang="en"> 781db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <h2>Description</h2> 791db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </div> 801db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect1" lang="en"> 811db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <h2>Details</h2> 821db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"> 831db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="DEBUG_MEMORY">Macro </a>DEBUG_MEMORY</h3><pre class="programlisting">#define <a href="#DEBUG_MEMORY">DEBUG_MEMORY</a>; 841db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p><a href="libxml2-xmlmemory.html#DEBUG_MEMORY">DEBUG_MEMORY</a> replaces the allocator with a collect and debug shell to the libc allocator. <a href="libxml2-xmlmemory.html#DEBUG_MEMORY">DEBUG_MEMORY</a> should only be activated when debugging libxml i.e. if libxml has been configured with --with-debug-mem too. #define DEBUG_MEMORY_FREED #define <a href="libxml2-xmlversion.html#DEBUG_MEMORY_LOCATION">DEBUG_MEMORY_LOCATION</a></p> 851db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</div> 861db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 871db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlFreeFunc"/>Function type xmlFreeFunc</h3><pre class="programlisting">void xmlFreeFunc (void * mem)<br/> 881db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>Signature for a free() implementation.</p> 891db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>mem</tt></i>:</span></td><td>an already allocated block of memory</td></tr></tbody></table></div></div> 901db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 911db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMallocFunc"/>Function type xmlMallocFunc</h3><pre class="programlisting">void * xmlMallocFunc (size_t size)<br/> 921db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>Signature for a malloc() implementation.</p> 931db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>the size requested in bytes</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the newly allocated block or NULL in case of error.</td></tr></tbody></table></div></div> 941db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 951db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlReallocFunc"/>Function type xmlReallocFunc</h3><pre class="programlisting">void * xmlReallocFunc (void * mem, <br/> size_t size)<br/> 961db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>Signature for a realloc() implementation.</p> 971db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>mem</tt></i>:</span></td><td>an already allocated block of memory</td></tr><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>the new size requested in bytes</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the newly reallocated block or NULL in case of error.</td></tr></tbody></table></div></div> 981db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 991db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlStrdupFunc"/>Function type xmlStrdupFunc</h3><pre class="programlisting">char * xmlStrdupFunc (const char * str)<br/> 1001db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>Signature for an strdup() implementation.</p> 1011db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>a zero terminated string</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the copy of the string or NULL in case of error.</td></tr></tbody></table></div></div> 1021db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1031db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlCleanupMemory"/>xmlCleanupMemory ()</h3><pre class="programlisting">void xmlCleanupMemory (void)<br/> 1041db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>Free up all the memory allocated by the library for its own use. This should not be called by user level code.</p> 1051db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</div> 1061db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1071db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlGcMemGet"/>xmlGcMemGet ()</h3><pre class="programlisting">int xmlGcMemGet (<a href="libxml2-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> * freeFunc, <br/> <a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> * mallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> * mallocAtomicFunc, <br/> <a href="libxml2-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> * reallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> * strdupFunc)<br/> 1081db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>Provides the memory access functions set currently in use The mallocAtomicFunc is specialized for atomic block allocations (i.e. of areas useful for garbage collected memory allocators</p> 1091db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>freeFunc</tt></i>:</span></td><td>place to save the free() function in use</td></tr><tr><td><span class="term"><i><tt>mallocFunc</tt></i>:</span></td><td>place to save the malloc() function in use</td></tr><tr><td><span class="term"><i><tt>mallocAtomicFunc</tt></i>:</span></td><td>place to save the atomic malloc() function in use</td></tr><tr><td><span class="term"><i><tt>reallocFunc</tt></i>:</span></td><td>place to save the realloc() function in use</td></tr><tr><td><span class="term"><i><tt>strdupFunc</tt></i>:</span></td><td>place to save the strdup() function in use</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success</td></tr></tbody></table></div></div> 1101db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1111db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlGcMemSetup"/>xmlGcMemSetup ()</h3><pre class="programlisting">int xmlGcMemSetup (<a href="libxml2-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> freeFunc, <br/> <a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> mallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> mallocAtomicFunc, <br/> <a href="libxml2-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> reallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> strdupFunc)<br/> 1121db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>Override the default memory access functions with a new set This has to be called before any other libxml routines ! The mallocAtomicFunc is specialized for atomic block allocations (i.e. of areas useful for garbage collected memory allocators Should this be blocked if there was already some allocations done ?</p> 1131db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>freeFunc</tt></i>:</span></td><td>the free() function to use</td></tr><tr><td><span class="term"><i><tt>mallocFunc</tt></i>:</span></td><td>the malloc() function to use</td></tr><tr><td><span class="term"><i><tt>mallocAtomicFunc</tt></i>:</span></td><td>the malloc() function to use for atomic allocations</td></tr><tr><td><span class="term"><i><tt>reallocFunc</tt></i>:</span></td><td>the realloc() function to use</td></tr><tr><td><span class="term"><i><tt>strdupFunc</tt></i>:</span></td><td>the strdup() function to use</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success</td></tr></tbody></table></div></div> 1141db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1151db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlInitMemory"/>xmlInitMemory ()</h3><pre class="programlisting">int xmlInitMemory (void)<br/> 1161db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>Initialize the memory layer.</p> 1171db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success</td></tr></tbody></table></div></div> 1181db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1191db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMallocAtomicLoc"/>xmlMallocAtomicLoc ()</h3><pre class="programlisting">void * xmlMallocAtomicLoc (size_t size, <br/> const char * file, <br/> int line)<br/> 1201db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>a malloc() equivalent, with logging of the allocation info.</p> 121bdec2183f34b37ee89ae1d330c6ad2bb4d76605fDaniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>an unsigned int specifying the size in byte to allocate.</td></tr><tr><td><span class="term"><i><tt>file</tt></i>:</span></td><td>the file name or NULL</td></tr><tr><td><span class="term"><i><tt>line</tt></i>:</span></td><td>the line number</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the allocated area or NULL in case of lack of memory.</td></tr></tbody></table></div></div> 1221db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1231db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMallocLoc"/>xmlMallocLoc ()</h3><pre class="programlisting">void * xmlMallocLoc (size_t size, <br/> const char * file, <br/> int line)<br/> 1241db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>a malloc() equivalent, with logging of the allocation info.</p> 1251db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>an int specifying the size in byte to allocate.</td></tr><tr><td><span class="term"><i><tt>file</tt></i>:</span></td><td>the file name or NULL</td></tr><tr><td><span class="term"><i><tt>line</tt></i>:</span></td><td>the line number</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the allocated area or NULL in case of lack of memory.</td></tr></tbody></table></div></div> 1261db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1271db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMemBlocks"/>xmlMemBlocks ()</h3><pre class="programlisting">int xmlMemBlocks (void)<br/> 1281db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>Provides the number of memory areas currently allocated</p> 1291db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>an int representing the number of blocks</td></tr></tbody></table></div></div> 1301db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1311db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMemDisplay"/>xmlMemDisplay ()</h3><pre class="programlisting">void xmlMemDisplay (FILE * fp)<br/> 1321db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>show in-extenso the memory blocks allocated</p> 1331db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>fp</tt></i>:</span></td><td>a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist</td></tr></tbody></table></div></div> 1341db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1352cba415895e2cf9a15567038151009869b6c52a7Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMemDisplayLast"/>xmlMemDisplayLast ()</h3><pre class="programlisting">void xmlMemDisplayLast (FILE * fp, <br/> long nbBytes)<br/> 1362cba415895e2cf9a15567038151009869b6c52a7Daniel Veillard</pre><p>the last nbBytes of memory allocated and not freed, useful for dumping the memory left allocated between two places at runtime.</p> 1372cba415895e2cf9a15567038151009869b6c52a7Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>fp</tt></i>:</span></td><td>a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist</td></tr><tr><td><span class="term"><i><tt>nbBytes</tt></i>:</span></td><td>the amount of memory to dump</td></tr></tbody></table></div></div> 1382cba415895e2cf9a15567038151009869b6c52a7Daniel Veillard <hr/> 1391db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMemFree"/>xmlMemFree ()</h3><pre class="programlisting">void xmlMemFree (void * ptr)<br/> 1401db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>a free() equivalent, with error checking.</p> 1411db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ptr</tt></i>:</span></td><td>the memory block pointer</td></tr></tbody></table></div></div> 1421db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1431db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMemGet"/>xmlMemGet ()</h3><pre class="programlisting">int xmlMemGet (<a href="libxml2-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> * freeFunc, <br/> <a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> * mallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> * reallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> * strdupFunc)<br/> 1441db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>Provides the memory access functions set currently in use</p> 1451db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>freeFunc</tt></i>:</span></td><td>place to save the free() function in use</td></tr><tr><td><span class="term"><i><tt>mallocFunc</tt></i>:</span></td><td>place to save the malloc() function in use</td></tr><tr><td><span class="term"><i><tt>reallocFunc</tt></i>:</span></td><td>place to save the realloc() function in use</td></tr><tr><td><span class="term"><i><tt>strdupFunc</tt></i>:</span></td><td>place to save the strdup() function in use</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success</td></tr></tbody></table></div></div> 1461db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1471db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMemMalloc"/>xmlMemMalloc ()</h3><pre class="programlisting">void * xmlMemMalloc (size_t size)<br/> 1481db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>a malloc() equivalent, with logging of the allocation info.</p> 1491db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>an int specifying the size in byte to allocate.</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the allocated area or NULL in case of lack of memory.</td></tr></tbody></table></div></div> 1501db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1511db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMemRealloc"/>xmlMemRealloc ()</h3><pre class="programlisting">void * xmlMemRealloc (void * ptr, <br/> size_t size)<br/> 1521db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>a realloc() equivalent, with logging of the allocation info.</p> 1531db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ptr</tt></i>:</span></td><td>the initial memory block pointer</td></tr><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>an int specifying the size in byte to allocate.</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the allocated area or NULL in case of lack of memory.</td></tr></tbody></table></div></div> 1541db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1551db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMemSetup"/>xmlMemSetup ()</h3><pre class="programlisting">int xmlMemSetup (<a href="libxml2-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> freeFunc, <br/> <a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> mallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> reallocFunc, <br/> <a href="libxml2-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> strdupFunc)<br/> 1561db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>Override the default memory access functions with a new set This has to be called before any other libxml routines ! Should this be blocked if there was already some allocations done ?</p> 1571db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>freeFunc</tt></i>:</span></td><td>the free() function to use</td></tr><tr><td><span class="term"><i><tt>mallocFunc</tt></i>:</span></td><td>the malloc() function to use</td></tr><tr><td><span class="term"><i><tt>reallocFunc</tt></i>:</span></td><td>the realloc() function to use</td></tr><tr><td><span class="term"><i><tt>strdupFunc</tt></i>:</span></td><td>the strdup() function to use</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success</td></tr></tbody></table></div></div> 1581db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1591db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMemShow"/>xmlMemShow ()</h3><pre class="programlisting">void xmlMemShow (FILE * fp, <br/> int nr)<br/> 1601db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>show a show display of the memory allocated, and dump the @nr last allocated areas which were not freed</p> 1611db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>fp</tt></i>:</span></td><td>a FILE descriptor used as the output file</td></tr><tr><td><span class="term"><i><tt>nr</tt></i>:</span></td><td>number of entries to dump</td></tr></tbody></table></div></div> 1621db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1631db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMemStrdupLoc"/>xmlMemStrdupLoc ()</h3><pre class="programlisting">char * xmlMemStrdupLoc (const char * str, <br/> const char * file, <br/> int line)<br/> 1641db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>a strdup() equivalent, with logging of the allocation info.</p> 1651db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>the initial string pointer</td></tr><tr><td><span class="term"><i><tt>file</tt></i>:</span></td><td>the file name or NULL</td></tr><tr><td><span class="term"><i><tt>line</tt></i>:</span></td><td>the line number</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the new string or NULL if allocation error occurred.</td></tr></tbody></table></div></div> 1661db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1671db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMemUsed"/>xmlMemUsed ()</h3><pre class="programlisting">int xmlMemUsed (void)<br/> 1681db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>Provides the amount of memory currently allocated</p> 1691db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>an int representing the amount of memory allocated.</td></tr></tbody></table></div></div> 1701db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1711db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMemoryDump"/>xmlMemoryDump ()</h3><pre class="programlisting">void xmlMemoryDump (void)<br/> 1721db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>Dump in-extenso the memory blocks allocated to the file .memorylist</p> 1731db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</div> 1741db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1751db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlMemoryStrdup"/>xmlMemoryStrdup ()</h3><pre class="programlisting">char * xmlMemoryStrdup (const char * str)<br/> 1761db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>a strdup() equivalent, with logging of the allocation info.</p> 1771db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>the initial string pointer</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the new string or NULL if allocation error occurred.</td></tr></tbody></table></div></div> 1781db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1791db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <div class="refsect2" lang="en"><h3><a name="xmlReallocLoc"/>xmlReallocLoc ()</h3><pre class="programlisting">void * xmlReallocLoc (void * ptr, <br/> size_t size, <br/> const char * file, <br/> int line)<br/> 1801db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</pre><p>a realloc() equivalent, with logging of the allocation info.</p> 1811db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ptr</tt></i>:</span></td><td>the initial memory block pointer</td></tr><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>an int specifying the size in byte to allocate.</td></tr><tr><td><span class="term"><i><tt>file</tt></i>:</span></td><td>the file name or NULL</td></tr><tr><td><span class="term"><i><tt>line</tt></i>:</span></td><td>the line number</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the allocated area or NULL in case of lack of memory.</td></tr></tbody></table></div></div> 1821db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard <hr/> 1831db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </div> 1841db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </div> 1851db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard </body> 1861db4a66b9aadf87939b2cd956a3e54bb95f41107Daniel Veillard</html> 187