blob: 320df0cd2cda4d7c2c46349db50f16c4722090e1 [file] [log] [blame]
Daniel Veillardd4330462003-04-29 12:40:16 +00001<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmlmemory</title><meta name="generator" content="DocBook XSL Stylesheets V1.58.1"><style xmlns="http://www.w3.org/TR/xhtml1/transitional" type="text/css">
2 .synopsis, .classsynopsis {
3 background: #eeeeee;
4 border: solid 1px #aaaaaa;
5 padding: 0.5em;
6 }
7 .programlisting {
8 background: #eeeeff;
9 border: solid 1px #aaaaff;
10 padding: 0.5em;
11 }
12 .variablelist {
13 padding: 4px;
14 margin-left: 3em;
15 }
16 .navigation {
17 background: #ffeeee;
18 border: solid 1px #ffaaaa;
19 margin-top: 0.5em;
20 margin-bottom: 0.5em;
21 }
22 .navigation a {
23 color: #770000;
24 }
25 .navigation a:visited {
26 color: #550000;
27 }
28 .navigation .title {
29 font-size: 200%;
30 }
31 </style><link rel="home" href="index.html" title="Gnome XML Library Reference Manual"><link rel="up" href="libxml-lib.html" title="Libxml Library Reference"><link rel="previous" href="libxml-debugXML.html" title="debugXML"><link rel="next" href="libxml-xmlregexp.html" title="xmlregexp"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-debugXML.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></img></a></td><td><a accesskey="u" href="libxml-lib.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></img></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></img></a></td><th width="100%" align="center">Gnome XML Library Reference Manual</th><td><a accesskey="n" href="libxml-xmlregexp.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></img></a></td></tr></table><div class="refentry" lang="en"><a name="libxml-xmlmemory"></a><div class="titlepage"></div><div class="refnamediv"><h2>xmlmemory</h2><p>xmlmemory &#8212; </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
Daniel Veillard7c1206f1999-10-14 09:10:25 +000032
Daniel Veillardd4330462003-04-29 12:40:16 +000033
34
35#define <a href="libxml-xmlmemory.html#DEBUG-MEMORY-CAPS">DEBUG_MEMORY</a>
36void (<a href="libxml-xmlmemory.html#xmlFreeFunc">*xmlFreeFunc</a>) (void *mem);
37void* (<a href="libxml-xmlmemory.html#xmlMallocFunc">*xmlMallocFunc</a>) (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size);
38void* (<a href="libxml-xmlmemory.html#xmlReallocFunc">*xmlReallocFunc</a>) (void *mem,
39 <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size);
40char* (<a href="libxml-xmlmemory.html#xmlStrdupFunc">*xmlStrdupFunc</a>) (const char *str);
41int <a href="libxml-xmlmemory.html#xmlMemSetup">xmlMemSetup</a> (<a href="libxml-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> freeFunc,
42 <a href="libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> mallocFunc,
43 <a href="libxml-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> reallocFunc,
44 <a href="libxml-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> strdupFunc);
45int <a href="libxml-xmlmemory.html#xmlMemGet">xmlMemGet</a> (<a href="libxml-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> *freeFunc,
46 <a href="libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> *mallocFunc,
47 <a href="libxml-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> *reallocFunc,
48 <a href="libxml-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> *strdupFunc);
49int <a href="libxml-xmlmemory.html#xmlGcMemSetup">xmlGcMemSetup</a> (<a href="libxml-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> freeFunc,
50 <a href="libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> mallocFunc,
51 <a href="libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> mallocAtomicFunc,
52 <a href="libxml-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> reallocFunc,
53 <a href="libxml-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> strdupFunc);
54int <a href="libxml-xmlmemory.html#xmlGcMemGet">xmlGcMemGet</a> (<a href="libxml-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> *freeFunc,
55 <a href="libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> *mallocFunc,
56 <a href="libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> *mallocAtomicFunc,
57 <a href="libxml-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> *reallocFunc,
58 <a href="libxml-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> *strdupFunc);
59int <a href="libxml-xmlmemory.html#xmlInitMemory">xmlInitMemory</a> (void);
60int <a href="libxml-xmlmemory.html#xmlMemUsed">xmlMemUsed</a> (void);
61void <a href="libxml-xmlmemory.html#xmlMemDisplay">xmlMemDisplay</a> (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="FILE-CAPS">FILE</GTKDOCLINK> *fp);
62void <a href="libxml-xmlmemory.html#xmlMemShow">xmlMemShow</a> (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="FILE-CAPS">FILE</GTKDOCLINK> *fp,
Daniel Veillardf3a73582000-01-05 14:58:39 +000063 int nr);
Daniel Veillardd4330462003-04-29 12:40:16 +000064void <a href="libxml-xmlmemory.html#xmlMemoryDump">xmlMemoryDump</a> (void);
65void* <a href="libxml-xmlmemory.html#xmlMemMalloc">xmlMemMalloc</a> (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size);
66void* <a href="libxml-xmlmemory.html#xmlMemRealloc">xmlMemRealloc</a> (void *ptr,
67 <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size);
68void <a href="libxml-xmlmemory.html#xmlMemFree">xmlMemFree</a> (void *ptr);
69char* <a href="libxml-xmlmemory.html#xmlMemoryStrdup">xmlMemoryStrdup</a> (const char *str);
Daniel Veillardd4330462003-04-29 12:40:16 +000070void* <a href="libxml-xmlmemory.html#xmlMallocLoc">xmlMallocLoc</a> (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size,
Daniel Veillard7c1206f1999-10-14 09:10:25 +000071 const char *file,
72 int line);
Daniel Veillardd4330462003-04-29 12:40:16 +000073void* <a href="libxml-xmlmemory.html#xmlReallocLoc">xmlReallocLoc</a> (void *ptr,
74 <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size,
Daniel Veillard7c1206f1999-10-14 09:10:25 +000075 const char *file,
76 int line);
Daniel Veillardcfba2fe2003-08-15 00:33:43 +000077void* <a href="libxml-xmlmemory.html#xmlMallocAtomicLoc">xmlMallocAtomicLoc</a> (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size,
78 const char *file,
79 int line);
Daniel Veillardd4330462003-04-29 12:40:16 +000080char* <a href="libxml-xmlmemory.html#xmlMemStrdupLoc">xmlMemStrdupLoc</a> (const char *str,
Daniel Veillard7c1206f1999-10-14 09:10:25 +000081 const char *file,
Daniel Veillardd4330462003-04-29 12:40:16 +000082 int line);
Daniel Veillardcfba2fe2003-08-15 00:33:43 +000083#define <a href="libxml-globals.html#xmlMalloc">xmlMalloc</a> (size)
84#define <a href="libxml-globals.html#xmlMallocAtomic">xmlMallocAtomic</a> (size)
85#define <a href="libxml-globals.html#xmlRealloc">xmlRealloc</a> (ptr, size)
86#define <a href="libxml-globals.html#xmlMemStrdup">xmlMemStrdup</a> (str)
Daniel Veillardd4330462003-04-29 12:40:16 +000087</pre></div><div class="refsect1" lang="en"><h2>Description</h2><p>
88
Daniel Veillardd7cec922003-06-13 12:30:10 +000089</p></div><div class="refsect1" lang="en"><h2>Details</h2><div class="refsect2" lang="en"><h3><a name="DEBUG-MEMORY-CAPS"></a>DEBUG_MEMORY</h3><pre class="programlisting">#define DEBUG_MEMORY
90</pre><p>
Daniel Veillardd4330462003-04-29 12:40:16 +000091DEBUG_MEMORY replaces the allocator with a collect and debug
Daniel Veillard19274092002-03-25 16:48:03 +000092shell to the libc allocator.
93DEBUG_MEMORY should only be activated when debugging
Daniel Veillardd4330462003-04-29 12:40:16 +000094libxml i.e. if libxml has been configured with --with-debug-mem too.</p><p>
95
96</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlFreeFunc"></a>xmlFreeFunc ()</h3><pre class="programlisting">void (*xmlFreeFunc) (void *mem);</pre><p>
97Signature for a <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="free">free</GTKDOCLINK>() implementation.</p><p>
98
Daniel Veillardd7cec922003-06-13 12:30:10 +000099</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>mem</tt></i> :</span></td><td> an already allocated block of memory
Daniel Veillardd4330462003-04-29 12:40:16 +0000100</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMallocFunc"></a>xmlMallocFunc ()</h3><pre class="programlisting">void* (*xmlMallocFunc) (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size);</pre><p>
101Signature for a <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="malloc">malloc</GTKDOCLINK>() implementation.</p><p>
102
Daniel Veillardd7cec922003-06-13 12:30:10 +0000103</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>size</tt></i> :</span></td><td> the size requested in bytes
Daniel Veillardd4330462003-04-29 12:40:16 +0000104</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlReallocFunc"></a>xmlReallocFunc ()</h3><pre class="programlisting">void* (*xmlReallocFunc) (void *mem,
105 <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size);</pre><p>
106Signature for a <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="realloc">realloc</GTKDOCLINK>() implementation.</p><p>
107
Daniel Veillardd7cec922003-06-13 12:30:10 +0000108</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>mem</tt></i> :</span></td><td> an already allocated block of memory
109</td></tr><tr><td><span class="term"><i><tt>size</tt></i> :</span></td><td> the new size requested in bytes
Daniel Veillardd4330462003-04-29 12:40:16 +0000110</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlStrdupFunc"></a>xmlStrdupFunc ()</h3><pre class="programlisting">char* (*xmlStrdupFunc) (const char *str);</pre><p>
111Signature for an <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="strdup">strdup</GTKDOCLINK>() implementation.</p><p>
112
Daniel Veillardd7cec922003-06-13 12:30:10 +0000113</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>str</tt></i> :</span></td><td> a zero terminated string
114</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the copy of the string or NULL in case of error.
Daniel Veillardd4330462003-04-29 12:40:16 +0000115</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMemSetup"></a>xmlMemSetup ()</h3><pre class="programlisting">int xmlMemSetup (<a href="libxml-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> freeFunc,
116 <a href="libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> mallocFunc,
117 <a href="libxml-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> reallocFunc,
118 <a href="libxml-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> strdupFunc);</pre><p>
119Override the default memory access functions with a new set
120This has to be called before any other libxml routines !
121</p><p>
122Should this be blocked if there was already some allocations
123done ?</p><p>
124
Daniel Veillardd7cec922003-06-13 12:30:10 +0000125</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>freeFunc</tt></i> :</span></td><td> the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="free">free</GTKDOCLINK>() function to use
126</td></tr><tr><td><span class="term"><i><tt>mallocFunc</tt></i> :</span></td><td> the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="malloc">malloc</GTKDOCLINK>() function to use
127</td></tr><tr><td><span class="term"><i><tt>reallocFunc</tt></i> :</span></td><td> the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="realloc">realloc</GTKDOCLINK>() function to use
128</td></tr><tr><td><span class="term"><i><tt>strdupFunc</tt></i> :</span></td><td> the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="strdup">strdup</GTKDOCLINK>() function to use
129</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>0 on success
Daniel Veillardd4330462003-04-29 12:40:16 +0000130</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMemGet"></a>xmlMemGet ()</h3><pre class="programlisting">int xmlMemGet (<a href="libxml-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> *freeFunc,
131 <a href="libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> *mallocFunc,
132 <a href="libxml-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> *reallocFunc,
133 <a href="libxml-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> *strdupFunc);</pre><p>
134Provides the memory access functions set currently in use</p><p>
135
Daniel Veillardd7cec922003-06-13 12:30:10 +0000136</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>freeFunc</tt></i> :</span></td><td> place to save the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="free">free</GTKDOCLINK>() function in use
137</td></tr><tr><td><span class="term"><i><tt>mallocFunc</tt></i> :</span></td><td> place to save the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="malloc">malloc</GTKDOCLINK>() function in use
138</td></tr><tr><td><span class="term"><i><tt>reallocFunc</tt></i> :</span></td><td> place to save the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="realloc">realloc</GTKDOCLINK>() function in use
139</td></tr><tr><td><span class="term"><i><tt>strdupFunc</tt></i> :</span></td><td> place to save the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="strdup">strdup</GTKDOCLINK>() function in use
140</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>0 on success
Daniel Veillardd4330462003-04-29 12:40:16 +0000141</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlGcMemSetup"></a>xmlGcMemSetup ()</h3><pre class="programlisting">int xmlGcMemSetup (<a href="libxml-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> freeFunc,
142 <a href="libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> mallocFunc,
143 <a href="libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> mallocAtomicFunc,
144 <a href="libxml-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> reallocFunc,
145 <a href="libxml-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> strdupFunc);</pre><p>
146Override the default memory access functions with a new set
147This has to be called before any other libxml routines !
148The mallocAtomicFunc is specialized for atomic block
149allocations (i.e. of areas useful for garbage collected memory allocators
150</p><p>
151Should this be blocked if there was already some allocations
152done ?</p><p>
153
Daniel Veillardd7cec922003-06-13 12:30:10 +0000154</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>freeFunc</tt></i> :</span></td><td> the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="free">free</GTKDOCLINK>() function to use
155</td></tr><tr><td><span class="term"><i><tt>mallocFunc</tt></i> :</span></td><td> the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="malloc">malloc</GTKDOCLINK>() function to use
156</td></tr><tr><td><span class="term"><i><tt>mallocAtomicFunc</tt></i> :</span></td><td> the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="malloc">malloc</GTKDOCLINK>() function to use for atomic allocations
157</td></tr><tr><td><span class="term"><i><tt>reallocFunc</tt></i> :</span></td><td> the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="realloc">realloc</GTKDOCLINK>() function to use
158</td></tr><tr><td><span class="term"><i><tt>strdupFunc</tt></i> :</span></td><td> the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="strdup">strdup</GTKDOCLINK>() function to use
159</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>0 on success
Daniel Veillardd4330462003-04-29 12:40:16 +0000160</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlGcMemGet"></a>xmlGcMemGet ()</h3><pre class="programlisting">int xmlGcMemGet (<a href="libxml-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> *freeFunc,
161 <a href="libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> *mallocFunc,
162 <a href="libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> *mallocAtomicFunc,
163 <a href="libxml-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> *reallocFunc,
164 <a href="libxml-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> *strdupFunc);</pre><p>
165Provides the memory access functions set currently in use
166The mallocAtomicFunc is specialized for atomic block
167allocations (i.e. of areas useful for garbage collected memory allocators</p><p>
168
Daniel Veillardd7cec922003-06-13 12:30:10 +0000169</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>freeFunc</tt></i> :</span></td><td> place to save the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="free">free</GTKDOCLINK>() function in use
170</td></tr><tr><td><span class="term"><i><tt>mallocFunc</tt></i> :</span></td><td> place to save the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="malloc">malloc</GTKDOCLINK>() function in use
171</td></tr><tr><td><span class="term"><i><tt>mallocAtomicFunc</tt></i> :</span></td><td> place to save the atomic <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="malloc">malloc</GTKDOCLINK>() function in use
172</td></tr><tr><td><span class="term"><i><tt>reallocFunc</tt></i> :</span></td><td> place to save the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="realloc">realloc</GTKDOCLINK>() function in use
173</td></tr><tr><td><span class="term"><i><tt>strdupFunc</tt></i> :</span></td><td> place to save the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="strdup">strdup</GTKDOCLINK>() function in use
174</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>0 on success
Daniel Veillardd4330462003-04-29 12:40:16 +0000175</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlInitMemory"></a>xmlInitMemory ()</h3><pre class="programlisting">int xmlInitMemory (void);</pre><p>
176Initialize the memory layer.</p><p>
177
Daniel Veillardd7cec922003-06-13 12:30:10 +0000178</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>0 on success
Daniel Veillardd4330462003-04-29 12:40:16 +0000179</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMemUsed"></a>xmlMemUsed ()</h3><pre class="programlisting">int xmlMemUsed (void);</pre><p>
180Provides the amount of memory currently allocated</p><p>
181
Daniel Veillardd7cec922003-06-13 12:30:10 +0000182</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>an int representing the amount of memory allocated.
Daniel Veillardd4330462003-04-29 12:40:16 +0000183</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMemDisplay"></a>xmlMemDisplay ()</h3><pre class="programlisting">void xmlMemDisplay (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="FILE-CAPS">FILE</GTKDOCLINK> *fp);</pre><p>
184show in-extenso the memory blocks allocated</p><p>
185
Daniel Veillardd7cec922003-06-13 12:30:10 +0000186</p><div class="variablelist"><table border="0"><col align="left" valign="top"><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
187 written to the file .memorylist
Daniel Veillardd4330462003-04-29 12:40:16 +0000188</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMemShow"></a>xmlMemShow ()</h3><pre class="programlisting">void xmlMemShow (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="FILE-CAPS">FILE</GTKDOCLINK> *fp,
189 int nr);</pre><p>
190show a show display of the memory allocated, and dump
191the <i><tt>nr</tt></i> last allocated areas which were not freed</p><p>
192
Daniel Veillardd7cec922003-06-13 12:30:10 +0000193</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>fp</tt></i> :</span></td><td> a FILE descriptor used as the output file
194</td></tr><tr><td><span class="term"><i><tt>nr</tt></i> :</span></td><td> number of entries to dump
Daniel Veillardd4330462003-04-29 12:40:16 +0000195</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMemoryDump"></a>xmlMemoryDump ()</h3><pre class="programlisting">void xmlMemoryDump (void);</pre><p>
196Dump in-extenso the memory blocks allocated to the file .memorylist</p><p>
197
198</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMemMalloc"></a>xmlMemMalloc ()</h3><pre class="programlisting">void* xmlMemMalloc (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size);</pre><p>
199a <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="malloc">malloc</GTKDOCLINK>() equivalent, with logging of the allocation info.</p><p>
200
Daniel Veillardd7cec922003-06-13 12:30:10 +0000201</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>size</tt></i> :</span></td><td> an int specifying the size in byte to allocate.
Daniel Veillardd4330462003-04-29 12:40:16 +0000202</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMemRealloc"></a>xmlMemRealloc ()</h3><pre class="programlisting">void* xmlMemRealloc (void *ptr,
203 <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size);</pre><p>
204a <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="realloc">realloc</GTKDOCLINK>() equivalent, with logging of the allocation info.</p><p>
205
Daniel Veillardd7cec922003-06-13 12:30:10 +0000206</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>ptr</tt></i> :</span></td><td> the initial memory block pointer
207</td></tr><tr><td><span class="term"><i><tt>size</tt></i> :</span></td><td> an int specifying the size in byte to allocate.
Daniel Veillardd4330462003-04-29 12:40:16 +0000208</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMemFree"></a>xmlMemFree ()</h3><pre class="programlisting">void xmlMemFree (void *ptr);</pre><p>
209a <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="free">free</GTKDOCLINK>() equivalent, with error checking.</p><p>
210
Daniel Veillardd7cec922003-06-13 12:30:10 +0000211</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>ptr</tt></i> :</span></td><td> the memory block pointer
Daniel Veillardd4330462003-04-29 12:40:16 +0000212</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMemoryStrdup"></a>xmlMemoryStrdup ()</h3><pre class="programlisting">char* xmlMemoryStrdup (const char *str);</pre><p>
213a <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="strdup">strdup</GTKDOCLINK>() equivalent, with logging of the allocation info.</p><p>
214
Daniel Veillardd7cec922003-06-13 12:30:10 +0000215</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>str</tt></i> :</span></td><td> the initial string pointer
216</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a pointer to the new string or NULL if allocation error occurred.
Daniel Veillardd4330462003-04-29 12:40:16 +0000217</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMallocLoc"></a>xmlMallocLoc ()</h3><pre class="programlisting">void* xmlMallocLoc (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size,
Daniel Veillard7c1206f1999-10-14 09:10:25 +0000218 const char *file,
Daniel Veillardd4330462003-04-29 12:40:16 +0000219 int line);</pre><p>
220a <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="malloc">malloc</GTKDOCLINK>() equivalent, with logging of the allocation info.</p><p>
221
Daniel Veillardd7cec922003-06-13 12:30:10 +0000222</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>size</tt></i> :</span></td><td> an int specifying the size in byte to allocate.
223</td></tr><tr><td><span class="term"><i><tt>file</tt></i> :</span></td><td> the file name or NULL
224</td></tr><tr><td><span class="term"><i><tt>line</tt></i> :</span></td><td> the line number
Daniel Veillardd4330462003-04-29 12:40:16 +0000225</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlReallocLoc"></a>xmlReallocLoc ()</h3><pre class="programlisting">void* xmlReallocLoc (void *ptr,
226 <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size,
Daniel Veillard7c1206f1999-10-14 09:10:25 +0000227 const char *file,
Daniel Veillardd4330462003-04-29 12:40:16 +0000228 int line);</pre><p>
229a <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="realloc">realloc</GTKDOCLINK>() equivalent, with logging of the allocation info.</p><p>
230
Daniel Veillardd7cec922003-06-13 12:30:10 +0000231</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>ptr</tt></i> :</span></td><td> the initial memory block pointer
232</td></tr><tr><td><span class="term"><i><tt>size</tt></i> :</span></td><td> an int specifying the size in byte to allocate.
233</td></tr><tr><td><span class="term"><i><tt>file</tt></i> :</span></td><td> the file name or NULL
234</td></tr><tr><td><span class="term"><i><tt>line</tt></i> :</span></td><td> the line number
Daniel Veillardcfba2fe2003-08-15 00:33:43 +0000235</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMallocAtomicLoc"></a>xmlMallocAtomicLoc ()</h3><pre class="programlisting">void* xmlMallocAtomicLoc (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="size-t">size_t</GTKDOCLINK> size,
236 const char *file,
237 int line);</pre><p>
238a <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="malloc">malloc</GTKDOCLINK>() equivalent, with logging of the allocation info.</p><p>
239
240</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>size</tt></i> :</span></td><td> an int specifying the size in byte to allocate.
241</td></tr><tr><td><span class="term"><i><tt>file</tt></i> :</span></td><td> the file name or NULL
242</td></tr><tr><td><span class="term"><i><tt>line</tt></i> :</span></td><td> the line number
Daniel Veillardd4330462003-04-29 12:40:16 +0000243</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMemStrdupLoc"></a>xmlMemStrdupLoc ()</h3><pre class="programlisting">char* xmlMemStrdupLoc (const char *str,
Daniel Veillard7c1206f1999-10-14 09:10:25 +0000244 const char *file,
Daniel Veillardd4330462003-04-29 12:40:16 +0000245 int line);</pre><p>
246a <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="strdup">strdup</GTKDOCLINK>() equivalent, with logging of the allocation info.</p><p>
247
Daniel Veillardd7cec922003-06-13 12:30:10 +0000248</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>str</tt></i> :</span></td><td> the initial string pointer
249</td></tr><tr><td><span class="term"><i><tt>file</tt></i> :</span></td><td> the file name or NULL
250</td></tr><tr><td><span class="term"><i><tt>line</tt></i> :</span></td><td> the line number
251</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a pointer to the new string or NULL if allocation error occurred.
Daniel Veillardcfba2fe2003-08-15 00:33:43 +0000252</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMalloc"></a>xmlMalloc()</h3><pre class="programlisting">#define xmlMalloc(size)</pre><p>
253Wrapper for the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="malloc">malloc</GTKDOCLINK>() function used in the XML library.</p><p>
254
255</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>size</tt></i> :</span></td><td> number of bytes to allocate
256</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMallocAtomic"></a>xmlMallocAtomic()</h3><pre class="programlisting">#define xmlMallocAtomic(size)</pre><p>
257Wrapper for the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="malloc">malloc</GTKDOCLINK>() function used in the XML library for allocation
258of block not containing pointers to other areas.</p><p>
259
260</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>size</tt></i> :</span></td><td> number of bytes to allocate
261</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRealloc"></a>xmlRealloc()</h3><pre class="programlisting">#define xmlRealloc(ptr, size)</pre><p>
262Wrapper for the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="realloc">realloc</GTKDOCLINK>() function used in the XML library.</p><p>
263
264</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>ptr</tt></i> :</span></td><td> pointer to the existing allocated area
265</td></tr><tr><td><span class="term"><i><tt>size</tt></i> :</span></td><td> number of bytes to allocate
266</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlMemStrdup"></a>xmlMemStrdup()</h3><pre class="programlisting">#define xmlMemStrdup(str)</pre><p>
267Wrapper for the <GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="strdup">strdup</GTKDOCLINK>() function, <a href="libxml-parser.html#xmlStrdup">xmlStrdup</a>() is usually preferred.</p><p>
268
269</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>str</tt></i> :</span></td><td> pointer to the existing string
Daniel Veillardd4330462003-04-29 12:40:16 +0000270</td></tr></tbody></table></div></div></div></div><table xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="libxml-debugXML.html"><b>&lt;&lt; debugXML</b></a></td><td align="right"><a accesskey="n" href="libxml-xmlregexp.html"><b>xmlregexp &gt;&gt;</b></a></td></tr></table></body></html>