Imported Upstream version 2.9.4
[platform/upstream/libxml2.git] / doc / devhelp / libxml2-xmlmemory.html
1 <?xml version="1.0" encoding="UTF-8"?>
2 <html>
3   <head>
4     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
5     <title>xmlmemory: interface for the memory allocator</title>
6     <meta name="generator" content="Libxml2 devhelp stylesheet"/>
7     <link rel="start" href="index.html" title="libxml2 Reference Manual"/>
8     <link rel="up" href="general.html" title="API"/>
9     <link rel="stylesheet" href="style.css" type="text/css"/>
10     <link rel="chapter" href="general.html" title="API"/>
11   </head>
12   <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13     <table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
14       <tr valign="middle">
15         <td>
16           <a accesskey="p" href="libxml2-xmlexports.html">
17             <img src="left.png" width="24" height="24" border="0" alt="Prev"/>
18           </a>
19         </td>
20         <td>
21           <a accesskey="u" href="general.html">
22             <img src="up.png" width="24" height="24" border="0" alt="Up"/>
23           </a>
24         </td>
25         <td>
26           <a accesskey="h" href="index.html">
27             <img src="home.png" width="24" height="24" border="0" alt="Home"/>
28           </a>
29         </td>
30         <td>
31           <a accesskey="n" href="libxml2-xmlmodule.html">
32             <img src="right.png" width="24" height="24" border="0" alt="Next"/>
33           </a>
34         </td>
35         <th width="100%" align="center">libxml2 Reference Manual</th>
36       </tr>
37     </table>
38     <h2>
39       <span class="refentrytitle">xmlmemory</span>
40     </h2>
41     <p>xmlmemory - interface for the memory allocator</p>
42     <p>provides interfaces for the memory allocator, including debugging capabilities. </p>
43     <p>Author(s): Daniel Veillard </p>
44     <div class="refsynopsisdiv">
45       <h2>Synopsis</h2>
46       <pre class="synopsis">#define <a href="#xmlRealloc">xmlRealloc</a>;
47 #define <a href="#xmlMalloc">xmlMalloc</a>;
48 #define <a href="#xmlMallocAtomic">xmlMallocAtomic</a>;
49 #define <a href="#DEBUG_MEMORY">DEBUG_MEMORY</a>;
50 #define <a href="#xmlMemStrdup">xmlMemStrdup</a>;
51 void *  <a href="#xmlMemRealloc">xmlMemRealloc</a>                      (void * ptr, <br/>                                       size_t size);
52 int     <a href="#xmlInitMemory">xmlInitMemory</a>                      (void);
53 void    <a href="#xmlMemFree">xmlMemFree</a>                    (void * ptr);
54 void *  <a href="#xmlMemMalloc">xmlMemMalloc</a>                        (size_t size);
55 void    <a href="#xmlMemDisplayLast">xmlMemDisplayLast</a>              (FILE * fp, <br/>                                        long nbBytes);
56 int     <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);
57 void    <a href="#xmlMemoryDump">xmlMemoryDump</a>                      (void);
58 void *  <a href="#xmlMallocLoc">xmlMallocLoc</a>                        (size_t size, <br/>                                      const char * file, <br/>                                        int line);
59 void    <a href="#xmlMemDisplay">xmlMemDisplay</a>                      (FILE * fp);
60 int     <a href="#xmlMemBlocks">xmlMemBlocks</a>                        (void);
61 int     <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);
62 typedef char * <a href="#xmlStrdupFunc">xmlStrdupFunc</a>                       (const char * str);
63 typedef void <a href="#xmlFreeFunc">xmlFreeFunc</a>                     (void * mem);
64 void    <a href="#xmlMemShow">xmlMemShow</a>                    (FILE * fp, <br/>                                        int nr);
65 void *  <a href="#xmlMallocAtomicLoc">xmlMallocAtomicLoc</a>            (size_t size, <br/>                                      const char * file, <br/>                                        int line);
66 void *  <a href="#xmlReallocLoc">xmlReallocLoc</a>                      (void * ptr, <br/>                                       size_t size, <br/>                                      const char * file, <br/>                                        int line);
67 void    <a href="#xmlCleanupMemory">xmlCleanupMemory</a>                (void);
68 int     <a href="#xmlMemUsed">xmlMemUsed</a>                    (void);
69 int     <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);
70 typedef void * <a href="#xmlReallocFunc">xmlReallocFunc</a>                     (void * mem, <br/>                                       size_t size);
71 typedef void * <a href="#xmlMallocFunc">xmlMallocFunc</a>                       (size_t size);
72 int     <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);
73 char *  <a href="#xmlMemoryStrdup">xmlMemoryStrdup</a>                  (const char * str);
74 char *  <a href="#xmlMemStrdupLoc">xmlMemStrdupLoc</a>                  (const char * str, <br/>                                         const char * file, <br/>                                        int line);
75 </pre>
76     </div>
77     <div class="refsect1" lang="en">
78       <h2>Description</h2>
79     </div>
80     <div class="refsect1" lang="en">
81       <h2>Details</h2>
82       <div class="refsect2" lang="en">
83         <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>;
84 </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>
85 </div>
86         <hr/>
87         <div class="refsect2" lang="en"><h3><a name="xmlFreeFunc"/>Function type xmlFreeFunc</h3><pre class="programlisting">void       xmlFreeFunc                     (void * mem)<br/>
88 </pre><p>Signature for a free() implementation.</p>
89 <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>
90         <hr/>
91         <div class="refsect2" lang="en"><h3><a name="xmlMallocFunc"/>Function type xmlMallocFunc</h3><pre class="programlisting">void * xmlMallocFunc                   (size_t size)<br/>
92 </pre><p>Signature for a malloc() implementation.</p>
93 <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>
94         <hr/>
95         <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/>
96 </pre><p>Signature for a realloc() implementation.</p>
97 <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>
98         <hr/>
99         <div class="refsect2" lang="en"><h3><a name="xmlStrdupFunc"/>Function type xmlStrdupFunc</h3><pre class="programlisting">char * xmlStrdupFunc                   (const char * str)<br/>
100 </pre><p>Signature for an strdup() implementation.</p>
101 <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>
102         <hr/>
103         <div class="refsect2" lang="en"><h3><a name="xmlCleanupMemory"/>xmlCleanupMemory ()</h3><pre class="programlisting">void        xmlCleanupMemory                (void)<br/>
104 </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>
105 </div>
106         <hr/>
107         <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/>
108 </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>
109 <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>
110         <hr/>
111         <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/>
112 </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>
113 <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>
114         <hr/>
115         <div class="refsect2" lang="en"><h3><a name="xmlInitMemory"/>xmlInitMemory ()</h3><pre class="programlisting">int       xmlInitMemory                   (void)<br/>
116 </pre><p>Initialize the memory layer.</p>
117 <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>
118         <hr/>
119         <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/>
120 </pre><p>a malloc() equivalent, with logging of the allocation info.</p>
121 <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>
122         <hr/>
123         <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/>
124 </pre><p>a malloc() equivalent, with logging of the allocation info.</p>
125 <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>
126         <hr/>
127         <div class="refsect2" lang="en"><h3><a name="xmlMemBlocks"/>xmlMemBlocks ()</h3><pre class="programlisting">int xmlMemBlocks                    (void)<br/>
128 </pre><p>Provides the number of memory areas currently allocated</p>
129 <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>
130         <hr/>
131         <div class="refsect2" lang="en"><h3><a name="xmlMemDisplay"/>xmlMemDisplay ()</h3><pre class="programlisting">void      xmlMemDisplay                   (FILE * fp)<br/>
132 </pre><p>show in-extenso the memory blocks allocated</p>
133 <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>
134         <hr/>
135         <div class="refsect2" lang="en"><h3><a name="xmlMemDisplayLast"/>xmlMemDisplayLast ()</h3><pre class="programlisting">void      xmlMemDisplayLast               (FILE * fp, <br/>                                        long nbBytes)<br/>
136 </pre><p>the last nbBytes of memory allocated and not freed, useful for dumping the memory left allocated between two places at runtime.</p>
137 <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>
138         <hr/>
139         <div class="refsect2" lang="en"><h3><a name="xmlMemFree"/>xmlMemFree ()</h3><pre class="programlisting">void    xmlMemFree                      (void * ptr)<br/>
140 </pre><p>a free() equivalent, with error checking.</p>
141 <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>
142         <hr/>
143         <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/>
144 </pre><p>Provides the memory access functions set currently in use</p>
145 <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>
146         <hr/>
147         <div class="refsect2" lang="en"><h3><a name="xmlMemMalloc"/>xmlMemMalloc ()</h3><pre class="programlisting">void *      xmlMemMalloc                    (size_t size)<br/>
148 </pre><p>a malloc() equivalent, with logging of the allocation info.</p>
149 <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>
150         <hr/>
151         <div class="refsect2" lang="en"><h3><a name="xmlMemRealloc"/>xmlMemRealloc ()</h3><pre class="programlisting">void *    xmlMemRealloc                   (void * ptr, <br/>                                       size_t size)<br/>
152 </pre><p>a realloc() equivalent, with logging of the allocation info.</p>
153 <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>
154         <hr/>
155         <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/>
156 </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>
157 <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>
158         <hr/>
159         <div class="refsect2" lang="en"><h3><a name="xmlMemShow"/>xmlMemShow ()</h3><pre class="programlisting">void    xmlMemShow                      (FILE * fp, <br/>                                        int nr)<br/>
160 </pre><p>show a show display of the memory allocated, and dump the @nr last allocated areas which were not freed</p>
161 <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>
162         <hr/>
163         <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/>
164 </pre><p>a strdup() equivalent, with logging of the allocation info.</p>
165 <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>
166         <hr/>
167         <div class="refsect2" lang="en"><h3><a name="xmlMemUsed"/>xmlMemUsed ()</h3><pre class="programlisting">int     xmlMemUsed                      (void)<br/>
168 </pre><p>Provides the amount of memory currently allocated</p>
169 <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>
170         <hr/>
171         <div class="refsect2" lang="en"><h3><a name="xmlMemoryDump"/>xmlMemoryDump ()</h3><pre class="programlisting">void      xmlMemoryDump                   (void)<br/>
172 </pre><p>Dump in-extenso the memory blocks allocated to the file .memorylist</p>
173 </div>
174         <hr/>
175         <div class="refsect2" lang="en"><h3><a name="xmlMemoryStrdup"/>xmlMemoryStrdup ()</h3><pre class="programlisting">char *        xmlMemoryStrdup                 (const char * str)<br/>
176 </pre><p>a strdup() equivalent, with logging of the allocation info.</p>
177 <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>
178         <hr/>
179         <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/>
180 </pre><p>a realloc() equivalent, with logging of the allocation info.</p>
181 <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>
182         <hr/>
183       </div>
184     </div>
185   </body>
186 </html>