/usr/share/gtk-doc/html/libvips/libvips-memory.html is in libvips-doc 7.26.3-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>memory</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="VIPS Reference Manual">
<link rel="up" href="ch01.html" title="Core VIPS API">
<link rel="prev" href="libvips-VipsArgument.html" title="VipsArgument">
<link rel="next" href="libvips-error.html" title="error">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="libvips-VipsArgument.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">VIPS Reference Manual</th>
<td><a accesskey="n" href="libvips-error.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#libvips-memory.synopsis" class="shortcut">Top</a>
|
<a href="#libvips-memory.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="libvips-memory"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libvips-memory.top_of_page"></a>memory</span></h2>
<p>memory — memory utilities</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="libvips-memory.stability-level"></a><h2>Stability Level</h2>
Stable, unless otherwise indicated
</div>
<div class="refsynopsisdiv">
<a name="libvips-memory.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include <vips/vips.h>
#define <a class="link" href="libvips-memory.html#VIPS-FREEF:CAPS" title="VIPS_FREEF()">VIPS_FREEF</a> (F,
S)
#define <a class="link" href="libvips-memory.html#VIPS-FREE:CAPS" title="VIPS_FREE()">VIPS_FREE</a> (S)
#define <a class="link" href="libvips-memory.html#VIPS-SETSTR:CAPS" title="VIPS_SETSTR()">VIPS_SETSTR</a> (S,
V)
#define <a class="link" href="libvips-memory.html#VIPS-NEW:CAPS" title="VIPS_NEW()">VIPS_NEW</a> (IM,
T)
#define <a class="link" href="libvips-memory.html#VIPS-ARRAY:CAPS" title="VIPS_ARRAY()">VIPS_ARRAY</a> (IM,
N,
T)
<span class="returnvalue">void</span> * <a class="link" href="libvips-memory.html#vips-malloc" title="vips_malloc ()">vips_malloc</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *image</code></em>,
<em class="parameter"><code><span class="type">size_t</span> size</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-memory.html#vips-free" title="vips_free ()">vips_free</a> (<em class="parameter"><code><span class="type">void</span> *s</code></em>);
<span class="returnvalue">char</span> * <a class="link" href="libvips-memory.html#vips-strdup" title="vips_strdup ()">vips_strdup</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *image</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *str</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="libvips-memory.description"></a><h2>Description</h2>
<p>
Simple memory allocation utilities. These functions and macros help
allocate and free memory. Most of VIPS uses them, though some parts use
the <code class="function">g_malloc()</code> system instead, confusingly.
</p>
<p>
If you compile with <code class="literal">DEBUGM</code> it will track allocations for you, though
valgrind or dmalloc are better solutions.
</p>
</div>
<div class="refsect1">
<a name="libvips-memory.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="VIPS-FREEF:CAPS"></a><h3>VIPS_FREEF()</h3>
<pre class="programlisting">#define VIPS_FREEF( F, S )</pre>
</div>
<hr>
<div class="refsect2">
<a name="VIPS-FREE:CAPS"></a><h3>VIPS_FREE()</h3>
<pre class="programlisting">#define VIPS_FREE( S )</pre>
</div>
<hr>
<div class="refsect2">
<a name="VIPS-SETSTR:CAPS"></a><h3>VIPS_SETSTR()</h3>
<pre class="programlisting">#define VIPS_SETSTR( S, V )</pre>
</div>
<hr>
<div class="refsect2">
<a name="VIPS-NEW:CAPS"></a><h3>VIPS_NEW()</h3>
<pre class="programlisting">#define VIPS_NEW( IM, T ) ((T *) vips_malloc( (IM), sizeof( T )))
</pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>IM</code></em> :</span></p></td>
<td>allocate memory local to <em class="parameter"><code>IM</code></em>, or <code class="literal">NULL</code> for no auto-free</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>T</code></em> :</span></p></td>
<td>type of thing to allocate</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A pointer of type <em class="parameter"><code>T</code></em> *, or <code class="literal">NULL</code> on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="VIPS-ARRAY:CAPS"></a><h3>VIPS_ARRAY()</h3>
<pre class="programlisting">#define VIPS_ARRAY( IM, N, T ) ((T *) vips_malloc( (IM), (N) * sizeof( T )))
</pre>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>IM</code></em> :</span></p></td>
<td>allocate memory local to <em class="parameter"><code>IM</code></em>, or <code class="literal">NULL</code> for no auto-free</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>N</code></em> :</span></p></td>
<td>number of <em class="parameter"><code>T</code></em> 's to allocate</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>T</code></em> :</span></p></td>
<td>type of thing to allocate</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A pointer of type <em class="parameter"><code>T</code></em> *, or <code class="literal">NULL</code> on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="vips-malloc"></a><h3>vips_malloc ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> * vips_malloc (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *image</code></em>,
<em class="parameter"><code><span class="type">size_t</span> size</code></em>);</pre>
<p>
Malloc local to <em class="parameter"><code>im</code></em>, that is, the memory will be automatically
freed for you when the image is closed. If <em class="parameter"><code>im</code></em> is <code class="literal">NULL</code>, you need to free
the memory explicitly with <a class="link" href="libvips-memory.html#vips-free" title="vips_free ()"><code class="function">vips_free()</code></a>.
If allocation fails <a class="link" href="libvips-memory.html#vips-malloc" title="vips_malloc ()"><code class="function">vips_malloc()</code></a> returns <code class="literal">NULL</code> and
sets an error message.
</p>
<p>
If two threads try to allocate local to the same <em class="parameter"><code>im</code></em> at the same time, you
can get heap corruption.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>image</code></em> :</span></p></td>
<td>allocate memory local to this <a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a>, or <code class="literal">NULL</code>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td>number of bytes to allocate</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a pointer to the allocated memory, or <code class="literal">NULL</code> on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="vips-free"></a><h3>vips_free ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> vips_free (<em class="parameter"><code><span class="type">void</span> *s</code></em>);</pre>
<p>
VIPS free function. VIPS tries to use this instead of <code class="function">free()</code>. It always
returns zero, so it can be used as a callback handler.
</p>
<p>
Only use it to free
memory that was previously allocated with <a class="link" href="libvips-memory.html#vips-malloc" title="vips_malloc ()"><code class="function">vips_malloc()</code></a> with a <code class="literal">NULL</code> first
argument.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>s</code></em> :</span></p></td>
<td>memory to free</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="vips-strdup"></a><h3>vips_strdup ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> * vips_strdup (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *image</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *str</code></em>);</pre>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.17</div>
</body>
</html>
|