~ubuntu-branches/ubuntu/utopic/vips/utopic-proposed

« back to all changes in this revision

Viewing changes to doc/reference/html/libvips-memory.html

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2014-06-21 16:35:51 UTC
  • mfrom: (1.2.23)
  • Revision ID: package-import@ubuntu.com-20140621163551-l7mq3sjc5pkf94eu
Tags: 7.38.6-1
* New upstream version.
* Remove no-longer-needed dependency on gcc 4.7 for armhf. (Closes:
  #748006)
* Upstream version includes new German transltion. (Closes: #743613)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
<html>
3
3
<head>
4
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
 
<title>memory</title>
 
5
<title>VIPS Reference Manual: memory</title>
6
6
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
7
7
<link rel="home" href="index.html" title="VIPS Reference Manual">
8
8
<link rel="up" href="ch01.html" title="Core VIPS API">
9
 
<link rel="prev" href="libvips-VipsArgument.html" title="VipsArgument">
 
9
<link rel="prev" href="VipsObject.html" title="VipsObject">
10
10
<link rel="next" href="libvips-error.html" title="error">
11
 
<meta name="generator" content="GTK-Doc V1.19 (XML mode)">
 
11
<meta name="generator" content="GTK-Doc V1.20 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
13
13
</head>
14
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15
 
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
16
 
<tr valign="middle">
17
 
<td><a accesskey="p" href="libvips-VipsArgument.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18
 
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19
 
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20
 
<th width="100%" align="center">VIPS Reference Manual</th>
21
 
<td><a accesskey="n" href="libvips-error.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22
 
</tr>
23
 
<tr><td colspan="5" class="shortcuts">
24
 
<a href="#libvips-memory.synopsis" class="shortcut">Top</a>
25
 
                   | 
26
 
                  <a href="#libvips-memory.description" class="shortcut">Description</a>
27
 
</td></tr>
28
 
</table>
 
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="10"><tr valign="middle">
 
16
<td width="100%" align="left" class="shortcuts">
 
17
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> 
 
18
                  <a href="#libvips-memory.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> 
 
19
                  <a href="#libvips-memory.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
 
20
</td>
 
21
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 
22
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 
23
<td><a accesskey="p" href="VipsObject.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 
24
<td><a accesskey="n" href="libvips-error.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 
25
</tr></table>
29
26
<div class="refentry">
30
27
<a name="libvips-memory"></a><div class="titlepage"></div>
31
28
<div class="refnamediv"><table width="100%"><tr>
33
30
<h2><span class="refentrytitle"><a name="libvips-memory.top_of_page"></a>memory</span></h2>
34
31
<p>memory — memory utilities</p>
35
32
</td>
36
 
<td valign="top" align="right"></td>
 
33
<td class="gallery_image" valign="top" align="right"></td>
37
34
</tr></table></div>
38
35
<div class="refsect1">
39
36
<a name="libvips-memory.stability-level"></a><h2>Stability Level</h2>
40
37
Stable, unless otherwise indicated
41
38
</div>
42
 
<div class="refsynopsisdiv">
43
 
<a name="libvips-memory.synopsis"></a><h2>Synopsis</h2>
44
 
<pre class="synopsis">
45
 
#include &lt;vips/vips.h&gt;
46
 
 
47
 
#define             <a class="link" href="libvips-memory.html#VIPS-FREEF:CAPS" title="VIPS_FREEF()">VIPS_FREEF</a>                          (F,
48
 
                                                         S)
49
 
#define             <a class="link" href="libvips-memory.html#VIPS-FREE:CAPS" title="VIPS_FREE()">VIPS_FREE</a>                           (S)
50
 
#define             <a class="link" href="libvips-memory.html#VIPS-SETSTR:CAPS" title="VIPS_SETSTR()">VIPS_SETSTR</a>                         (S,
51
 
                                                         V)
52
 
#define             <a class="link" href="libvips-memory.html#VIPS-NEW:CAPS" title="VIPS_NEW()">VIPS_NEW</a>                            (OBJ,
53
 
                                                         T)
54
 
#define             <a class="link" href="libvips-memory.html#VIPS-ARRAY:CAPS" title="VIPS_ARRAY()">VIPS_ARRAY</a>                          (OBJ,
55
 
                                                         N,
56
 
                                                         T)
57
 
<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="libvips-VipsArgument.html#VipsObject"><span class="type">VipsObject</span></a> *object</code></em>,
58
 
                                                         <em class="parameter"><code><span class="type">size_t</span> size</code></em>);
59
 
<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="libvips-VipsArgument.html#VipsObject"><span class="type">VipsObject</span></a> *object</code></em>,
60
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *str</code></em>);
61
 
<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> *buf</code></em>);
62
 
<span class="returnvalue">void</span>                <a class="link" href="libvips-memory.html#vips-tracked-free" title="vips_tracked_free ()">vips_tracked_free</a>                   (<em class="parameter"><code><span class="type">void</span> *s</code></em>);
63
 
<span class="returnvalue">void</span> *              <a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()">vips_tracked_malloc</a>                 (<em class="parameter"><code><span class="type">size_t</span> size</code></em>);
64
 
<span class="returnvalue">size_t</span>              <a class="link" href="libvips-memory.html#vips-tracked-get-mem" title="vips_tracked_get_mem ()">vips_tracked_get_mem</a>                (<em class="parameter"><code><span class="type">void</span></code></em>);
65
 
<span class="returnvalue">size_t</span>              <a class="link" href="libvips-memory.html#vips-tracked-get-mem-highwater" title="vips_tracked_get_mem_highwater ()">vips_tracked_get_mem_highwater</a>      (<em class="parameter"><code><span class="type">void</span></code></em>);
66
 
<span class="returnvalue">int</span>                 <a class="link" href="libvips-memory.html#vips-tracked-get-allocs" title="vips_tracked_get_allocs ()">vips_tracked_get_allocs</a>             (<em class="parameter"><code><span class="type">void</span></code></em>);
67
 
<span class="returnvalue">int</span>                 <a class="link" href="libvips-memory.html#vips-tracked-open" title="vips_tracked_open ()">vips_tracked_open</a>                   (<em class="parameter"><code>const <span class="type">char</span> *pathname</code></em>,
68
 
                                                         <em class="parameter"><code><span class="type">int</span> flags</code></em>,
69
 
                                                         <em class="parameter"><code>...</code></em>);
70
 
<span class="returnvalue">int</span>                 <a class="link" href="libvips-memory.html#vips-tracked-close" title="vips_tracked_close ()">vips_tracked_close</a>                  (<em class="parameter"><code><span class="type">int</span> fd</code></em>);
71
 
<span class="returnvalue">int</span>                 <a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()">vips_tracked_get_files</a>              (<em class="parameter"><code><span class="type">void</span></code></em>);
 
39
<div class="refsect1">
 
40
<a name="libvips-memory.functions"></a><h2>Functions</h2>
 
41
<div class="informaltable"><table width="100%" border="0">
 
42
<colgroup>
 
43
<col width="150px" class="functions_return">
 
44
<col class="functions_name">
 
45
</colgroup>
 
46
<tbody>
 
47
<tr>
 
48
<td class="define_keyword">#define</td>
 
49
<td class="function_name">
 
50
<a class="link" href="libvips-memory.html#VIPS-FREEF:CAPS" title="VIPS_FREEF()">VIPS_FREEF</a><span class="c_punctuation">()</span>
 
51
</td>
 
52
</tr>
 
53
<tr>
 
54
<td class="define_keyword">#define</td>
 
55
<td class="function_name">
 
56
<a class="link" href="libvips-memory.html#VIPS-FREE:CAPS" title="VIPS_FREE()">VIPS_FREE</a><span class="c_punctuation">()</span>
 
57
</td>
 
58
</tr>
 
59
<tr>
 
60
<td class="define_keyword">#define</td>
 
61
<td class="function_name">
 
62
<a class="link" href="libvips-memory.html#VIPS-SETSTR:CAPS" title="VIPS_SETSTR()">VIPS_SETSTR</a><span class="c_punctuation">()</span>
 
63
</td>
 
64
</tr>
 
65
<tr>
 
66
<td class="define_keyword">#define</td>
 
67
<td class="function_name">
 
68
<a class="link" href="libvips-memory.html#VIPS-NEW:CAPS" title="VIPS_NEW()">VIPS_NEW</a><span class="c_punctuation">()</span>
 
69
</td>
 
70
</tr>
 
71
<tr>
 
72
<td class="define_keyword">#define</td>
 
73
<td class="function_name">
 
74
<a class="link" href="libvips-memory.html#VIPS-ARRAY:CAPS" title="VIPS_ARRAY()">VIPS_ARRAY</a><span class="c_punctuation">()</span>
 
75
</td>
 
76
</tr>
 
77
<tr>
 
78
<td class="function_type">
 
79
<span class="returnvalue">void</span> *
 
80
</td>
 
81
<td class="function_name">
 
82
<a class="link" href="libvips-memory.html#vips-malloc" title="vips_malloc ()">vips_malloc</a> <span class="c_punctuation">()</span>
 
83
</td>
 
84
</tr>
 
85
<tr>
 
86
<td class="function_type">
 
87
<span class="returnvalue">char</span> *
 
88
</td>
 
89
<td class="function_name">
 
90
<a class="link" href="libvips-memory.html#vips-strdup" title="vips_strdup ()">vips_strdup</a> <span class="c_punctuation">()</span>
 
91
</td>
 
92
</tr>
 
93
<tr>
 
94
<td class="function_type">
 
95
<span class="returnvalue">int</span>
 
96
</td>
 
97
<td class="function_name">
 
98
<a class="link" href="libvips-memory.html#vips-free" title="vips_free ()">vips_free</a> <span class="c_punctuation">()</span>
 
99
</td>
 
100
</tr>
 
101
<tr>
 
102
<td class="function_type">
 
103
<span class="returnvalue">void</span>
 
104
</td>
 
105
<td class="function_name">
 
106
<a class="link" href="libvips-memory.html#vips-tracked-free" title="vips_tracked_free ()">vips_tracked_free</a> <span class="c_punctuation">()</span>
 
107
</td>
 
108
</tr>
 
109
<tr>
 
110
<td class="function_type">
 
111
<span class="returnvalue">void</span> *
 
112
</td>
 
113
<td class="function_name">
 
114
<a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()">vips_tracked_malloc</a> <span class="c_punctuation">()</span>
 
115
</td>
 
116
</tr>
 
117
<tr>
 
118
<td class="function_type">
 
119
<span class="returnvalue">size_t</span>
 
120
</td>
 
121
<td class="function_name">
 
122
<a class="link" href="libvips-memory.html#vips-tracked-get-mem" title="vips_tracked_get_mem ()">vips_tracked_get_mem</a> <span class="c_punctuation">()</span>
 
123
</td>
 
124
</tr>
 
125
<tr>
 
126
<td class="function_type">
 
127
<span class="returnvalue">size_t</span>
 
128
</td>
 
129
<td class="function_name">
 
130
<a class="link" href="libvips-memory.html#vips-tracked-get-mem-highwater" title="vips_tracked_get_mem_highwater ()">vips_tracked_get_mem_highwater</a> <span class="c_punctuation">()</span>
 
131
</td>
 
132
</tr>
 
133
<tr>
 
134
<td class="function_type">
 
135
<span class="returnvalue">int</span>
 
136
</td>
 
137
<td class="function_name">
 
138
<a class="link" href="libvips-memory.html#vips-tracked-get-allocs" title="vips_tracked_get_allocs ()">vips_tracked_get_allocs</a> <span class="c_punctuation">()</span>
 
139
</td>
 
140
</tr>
 
141
<tr>
 
142
<td class="function_type">
 
143
<span class="returnvalue">int</span>
 
144
</td>
 
145
<td class="function_name">
 
146
<a class="link" href="libvips-memory.html#vips-tracked-open" title="vips_tracked_open ()">vips_tracked_open</a> <span class="c_punctuation">()</span>
 
147
</td>
 
148
</tr>
 
149
<tr>
 
150
<td class="function_type">
 
151
<span class="returnvalue">int</span>
 
152
</td>
 
153
<td class="function_name">
 
154
<a class="link" href="libvips-memory.html#vips-tracked-close" title="vips_tracked_close ()">vips_tracked_close</a> <span class="c_punctuation">()</span>
 
155
</td>
 
156
</tr>
 
157
<tr>
 
158
<td class="function_type">
 
159
<span class="returnvalue">int</span>
 
160
</td>
 
161
<td class="function_name">
 
162
<a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()">vips_tracked_get_files</a> <span class="c_punctuation">()</span>
 
163
</td>
 
164
</tr>
 
165
</tbody>
 
166
</table></div>
 
167
</div>
 
168
<div class="refsect1">
 
169
<a name="libvips-memory.object-hierarchy"></a><h2>Object Hierarchy</h2>
 
170
<pre class="screen">
 
171
</pre>
 
172
</div>
 
173
<div class="refsect1">
 
174
<a name="libvips-memory.includes"></a><h2>Includes</h2>
 
175
<pre class="synopsis">#include &lt;vips/vips.h&gt;
72
176
</pre>
73
177
</div>
74
178
<div class="refsect1">
75
179
<a name="libvips-memory.description"></a><h2>Description</h2>
76
 
<p>
77
 
These functions cover two main areas.
78
 
</p>
79
 
<p>
80
 
First, some simple utility functions over the underlying
81
 
<code class="function">g_malloc()</code>/<code class="function">g_free()</code> functions. Memory allocated and freeded using these
82
 
functions is interchangeable with any other glib library.
83
 
</p>
84
 
<p>
85
 
Second, a pair of functions, <a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a> and <a class="link" href="libvips-memory.html#vips-tracked-free" title="vips_tracked_free ()"><code class="function">vips_tracked_free()</code></a>,
86
 
which are NOT compatible. If you <code class="function">g_free()</code> memory that has been allocated
87
 
with <a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a> you will see crashes. 
88
 
</p>
89
 
<p>
90
 
The tracked functions are
 
180
<p>These functions cover two main areas.</p>
 
181
<p>First, some simple utility functions over the underlying
 
182
<a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-malloc"><code class="function">g_malloc()</code></a>/<a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a> functions. Memory allocated and freeded using these
 
183
functions is interchangeable with any other glib library.</p>
 
184
<p>Second, a pair of functions, <a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a> and <a class="link" href="libvips-memory.html#vips-tracked-free" title="vips_tracked_free ()"><code class="function">vips_tracked_free()</code></a>,
 
185
which are NOT compatible. If you <a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a> memory that has been allocated
 
186
with <a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a> you will see crashes. </p>
 
187
<p>The tracked functions are
91
188
only suitable for large allocations internal to the library, for example
92
189
pixel buffers. libvips watches the total amount of live tracked memory and
93
 
uses this information to decide when to trim caches.
94
 
</p>
 
190
uses this information to decide when to trim caches.</p>
95
191
</div>
96
192
<div class="refsect1">
97
 
<a name="libvips-memory.details"></a><h2>Details</h2>
 
193
<a name="libvips-memory.functions_details"></a><h2>Functions</h2>
98
194
<div class="refsect2">
99
195
<a name="VIPS-FREEF:CAPS"></a><h3>VIPS_FREEF()</h3>
100
196
<pre class="programlisting">#define             VIPS_FREEF( F, S )</pre>
120
216
<div class="refsect2">
121
217
<a name="VIPS-NEW:CAPS"></a><h3>VIPS_NEW()</h3>
122
218
<pre class="programlisting">#define             VIPS_NEW( OBJ, T )</pre>
123
 
<div class="variablelist"><table border="0" class="variablelist">
 
219
<div class="refsect3">
 
220
<a name="id-1.2.10.8.5.4"></a><h4>Parameters</h4>
 
221
<div class="informaltable"><table width="100%" border="0">
124
222
<colgroup>
125
 
<col align="left" valign="top">
126
 
<col>
 
223
<col width="150px" class="parameters_name">
 
224
<col class="parameters_description">
 
225
<col width="200px" class="parameters_annotations">
127
226
</colgroup>
128
227
<tbody>
129
228
<tr>
130
 
<td><p><span class="term"><em class="parameter"><code>OBJ</code></em> :</span></p></td>
131
 
<td>allocate memory local to <em class="parameter"><code>OBJ</code></em>, or <code class="literal">NULL</code> for no auto-free</td>
132
 
</tr>
133
 
<tr>
134
 
<td><p><span class="term"><em class="parameter"><code>T</code></em> :</span></p></td>
135
 
<td>type of thing to allocate</td>
136
 
</tr>
137
 
<tr>
138
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
139
 
<td>A pointer of type <em class="parameter"><code>T</code></em> *, or <code class="literal">NULL</code> on error.</td>
 
229
<td class="parameter_name"><p>OBJ</p></td>
 
230
<td class="parameter_description"><p>allocate memory local to <em class="parameter"><code>OBJ</code></em>
 
231
, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for no auto-free</p></td>
 
232
<td class="parameter_annotations"> </td>
 
233
</tr>
 
234
<tr>
 
235
<td class="parameter_name"><p>T</p></td>
 
236
<td class="parameter_description"><p>type of thing to allocate</p></td>
 
237
<td class="parameter_annotations"> </td>
140
238
</tr>
141
239
</tbody>
142
240
</table></div>
143
241
</div>
 
242
<div class="refsect3">
 
243
<a name="id-1.2.10.8.5.5"></a><h4>Returns</h4>
 
244
<p> A pointer of type <em class="parameter"><code>T</code></em>
 
245
*, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.</p>
 
246
<p></p>
 
247
</div>
 
248
</div>
144
249
<hr>
145
250
<div class="refsect2">
146
251
<a name="VIPS-ARRAY:CAPS"></a><h3>VIPS_ARRAY()</h3>
147
252
<pre class="programlisting">#define             VIPS_ARRAY( OBJ, N, T )</pre>
148
 
<div class="variablelist"><table border="0" class="variablelist">
149
 
<colgroup>
150
 
<col align="left" valign="top">
151
 
<col>
152
 
</colgroup>
153
 
<tbody>
154
 
<tr>
155
 
<td><p><span class="term"><em class="parameter"><code>OBJ</code></em> :</span></p></td>
156
 
<td>allocate memory local to <em class="parameter"><code>OBJ</code></em>, or <code class="literal">NULL</code> for no auto-free</td>
157
 
</tr>
158
 
<tr>
159
 
<td><p><span class="term"><em class="parameter"><code>N</code></em> :</span></p></td>
160
 
<td>number of <em class="parameter"><code>T</code></em> 's to allocate</td>
161
 
</tr>
162
 
<tr>
163
 
<td><p><span class="term"><em class="parameter"><code>T</code></em> :</span></p></td>
164
 
<td>type of thing to allocate</td>
165
 
</tr>
166
 
<tr>
167
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
168
 
<td>A pointer of type <em class="parameter"><code>T</code></em> *, or <code class="literal">NULL</code> on error.</td>
169
 
</tr>
170
 
</tbody>
171
 
</table></div>
172
 
</div>
173
 
<hr>
174
 
<div class="refsect2">
175
 
<a name="vips-malloc"></a><h3>vips_malloc ()</h3>
176
 
<pre class="programlisting"><span class="returnvalue">void</span> *              vips_malloc                         (<em class="parameter"><code><a class="link" href="libvips-VipsArgument.html#VipsObject"><span class="type">VipsObject</span></a> *object</code></em>,
177
 
                                                         <em class="parameter"><code><span class="type">size_t</span> size</code></em>);</pre>
178
 
<p>
179
 
<code class="function">g_malloc()</code> local to <em class="parameter"><code>object</code></em>, that is, the memory will be automatically 
180
 
freed for you when the object is closed. If <em class="parameter"><code>object</code></em> is <code class="literal">NULL</code>, you need to 
181
 
free the memory explicitly with <code class="function">g_free()</code>.
182
 
</p>
183
 
<p>
184
 
This function cannot fail. See <a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a> if you are 
185
 
allocating large amounts of memory.
186
 
</p>
187
 
<p>
188
 
See also: <a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a>.
189
 
</p>
190
 
<div class="variablelist"><table border="0" class="variablelist">
191
 
<colgroup>
192
 
<col align="left" valign="top">
193
 
<col>
194
 
</colgroup>
195
 
<tbody>
196
 
<tr>
197
 
<td><p><span class="term"><em class="parameter"><code>object</code></em> :</span></p></td>
198
 
<td>allocate memory local to this <a class="link" href="libvips-VipsArgument.html#VipsObject"><span class="type">VipsObject</span></a>, or <code class="literal">NULL</code>
199
 
</td>
200
 
</tr>
201
 
<tr>
202
 
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
203
 
<td>number of bytes to allocate</td>
204
 
</tr>
205
 
<tr>
206
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
207
 
<td>a pointer to the allocated memory</td>
208
 
</tr>
209
 
</tbody>
210
 
</table></div>
211
 
</div>
212
 
<hr>
213
 
<div class="refsect2">
214
 
<a name="vips-strdup"></a><h3>vips_strdup ()</h3>
215
 
<pre class="programlisting"><span class="returnvalue">char</span> *              vips_strdup                         (<em class="parameter"><code><a class="link" href="libvips-VipsArgument.html#VipsObject"><span class="type">VipsObject</span></a> *object</code></em>,
216
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *str</code></em>);</pre>
217
 
<p>
218
 
<code class="function">g_strdup()</code> a string. When <em class="parameter"><code>object</code></em> is freed, the string will be freed for
219
 
you.  If <em class="parameter"><code>object</code></em> is <code class="literal">NULL</code>, you need to 
220
 
free the memory explicitly with <code class="function">g_free()</code>.
221
 
</p>
222
 
<p>
223
 
This function cannot fail. 
224
 
</p>
225
 
<p>
226
 
See also: <a class="link" href="libvips-memory.html#vips-malloc" title="vips_malloc ()"><code class="function">vips_malloc()</code></a>.
227
 
</p>
228
 
<div class="variablelist"><table border="0" class="variablelist">
229
 
<colgroup>
230
 
<col align="left" valign="top">
231
 
<col>
232
 
</colgroup>
233
 
<tbody>
234
 
<tr>
235
 
<td><p><span class="term"><em class="parameter"><code>object</code></em> :</span></p></td>
236
 
<td>allocate memory local to this <a class="link" href="libvips-VipsArgument.html#VipsObject"><span class="type">VipsObject</span></a>, or <code class="literal">NULL</code>
237
 
</td>
238
 
</tr>
239
 
<tr>
240
 
<td><p><span class="term"><em class="parameter"><code>str</code></em> :</span></p></td>
241
 
<td>string to copy</td>
242
 
</tr>
243
 
<tr>
244
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
245
 
<td>a pointer to the allocated memory</td>
246
 
</tr>
247
 
</tbody>
248
 
</table></div>
249
 
</div>
250
 
<hr>
251
 
<div class="refsect2">
252
 
<a name="vips-free"></a><h3>vips_free ()</h3>
253
 
<pre class="programlisting"><span class="returnvalue">int</span>                 vips_free                           (<em class="parameter"><code><span class="type">void</span> *buf</code></em>);</pre>
254
 
<p>
255
 
Frees memory with <code class="function">g_free()</code> and returns 0. Handy for callbacks.
256
 
</p>
257
 
<p>
258
 
See also: <a class="link" href="libvips-memory.html#vips-malloc" title="vips_malloc ()"><code class="function">vips_malloc()</code></a>.
259
 
</p>
260
 
<div class="variablelist"><table border="0" class="variablelist">
261
 
<colgroup>
262
 
<col align="left" valign="top">
263
 
<col>
264
 
</colgroup>
265
 
<tbody><tr>
266
 
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
267
 
<td>memory to free</td>
268
 
</tr></tbody>
269
 
</table></div>
270
 
</div>
271
 
<hr>
272
 
<div class="refsect2">
273
 
<a name="vips-tracked-free"></a><h3>vips_tracked_free ()</h3>
274
 
<pre class="programlisting"><span class="returnvalue">void</span>                vips_tracked_free                   (<em class="parameter"><code><span class="type">void</span> *s</code></em>);</pre>
275
 
<p>
276
 
Only use it to free
277
 
memory that was previously allocated with <a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a> with a 
278
 
<code class="literal">NULL</code> first argument.
279
 
</p>
280
 
<p>
281
 
See also: <a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a>.
282
 
</p>
283
 
<div class="variablelist"><table border="0" class="variablelist">
284
 
<colgroup>
285
 
<col align="left" valign="top">
286
 
<col>
287
 
</colgroup>
288
 
<tbody><tr>
289
 
<td><p><span class="term"><em class="parameter"><code>s</code></em> :</span></p></td>
290
 
<td>memory to free</td>
291
 
</tr></tbody>
292
 
</table></div>
293
 
</div>
294
 
<hr>
295
 
<div class="refsect2">
296
 
<a name="vips-tracked-malloc"></a><h3>vips_tracked_malloc ()</h3>
297
 
<pre class="programlisting"><span class="returnvalue">void</span> *              vips_tracked_malloc                 (<em class="parameter"><code><span class="type">size_t</span> size</code></em>);</pre>
298
 
<p>
299
 
Allocate an area of memory that will be tracked by <a class="link" href="libvips-memory.html#vips-tracked-get-mem" title="vips_tracked_get_mem ()"><code class="function">vips_tracked_get_mem()</code></a>
300
 
and friends. 
301
 
</p>
302
 
<p>
303
 
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 
304
 
sets an error message.
305
 
</p>
306
 
<p>
307
 
You must only free the memory returned with <a class="link" href="libvips-memory.html#vips-tracked-free" title="vips_tracked_free ()"><code class="function">vips_tracked_free()</code></a>.
308
 
</p>
309
 
<p>
310
 
See also: <a class="link" href="libvips-memory.html#vips-tracked-free" title="vips_tracked_free ()"><code class="function">vips_tracked_free()</code></a>, <a class="link" href="libvips-memory.html#vips-malloc" title="vips_malloc ()"><code class="function">vips_malloc()</code></a>.
311
 
</p>
312
 
<div class="variablelist"><table border="0" class="variablelist">
313
 
<colgroup>
314
 
<col align="left" valign="top">
315
 
<col>
316
 
</colgroup>
317
 
<tbody>
318
 
<tr>
319
 
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
320
 
<td>number of bytes to allocate</td>
321
 
</tr>
322
 
<tr>
323
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
324
 
<td>a pointer to the allocated memory, or <code class="literal">NULL</code> on error.</td>
325
 
</tr>
326
 
</tbody>
327
 
</table></div>
328
 
</div>
329
 
<hr>
330
 
<div class="refsect2">
331
 
<a name="vips-tracked-get-mem"></a><h3>vips_tracked_get_mem ()</h3>
332
 
<pre class="programlisting"><span class="returnvalue">size_t</span>              vips_tracked_get_mem                (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
333
 
<p>
334
 
Returns the number of bytes currently allocated via <a class="link" href="libvips-memory.html#vips-malloc" title="vips_malloc ()"><code class="function">vips_malloc()</code></a> and
 
253
<div class="refsect3">
 
254
<a name="id-1.2.10.8.6.4"></a><h4>Parameters</h4>
 
255
<div class="informaltable"><table width="100%" border="0">
 
256
<colgroup>
 
257
<col width="150px" class="parameters_name">
 
258
<col class="parameters_description">
 
259
<col width="200px" class="parameters_annotations">
 
260
</colgroup>
 
261
<tbody>
 
262
<tr>
 
263
<td class="parameter_name"><p>OBJ</p></td>
 
264
<td class="parameter_description"><p>allocate memory local to <em class="parameter"><code>OBJ</code></em>
 
265
, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for no auto-free</p></td>
 
266
<td class="parameter_annotations"> </td>
 
267
</tr>
 
268
<tr>
 
269
<td class="parameter_name"><p>N</p></td>
 
270
<td class="parameter_description"><p>number of <em class="parameter"><code>T</code></em>
 
271
's to allocate</p></td>
 
272
<td class="parameter_annotations"> </td>
 
273
</tr>
 
274
<tr>
 
275
<td class="parameter_name"><p>T</p></td>
 
276
<td class="parameter_description"><p>type of thing to allocate</p></td>
 
277
<td class="parameter_annotations"> </td>
 
278
</tr>
 
279
</tbody>
 
280
</table></div>
 
281
</div>
 
282
<div class="refsect3">
 
283
<a name="id-1.2.10.8.6.5"></a><h4>Returns</h4>
 
284
<p> A pointer of type <em class="parameter"><code>T</code></em>
 
285
*, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.</p>
 
286
<p></p>
 
287
</div>
 
288
</div>
 
289
<hr>
 
290
<div class="refsect2">
 
291
<a name="vips-malloc"></a><h3>vips_malloc ()</h3>
 
292
<pre class="programlisting"><span class="returnvalue">void</span> *
 
293
vips_malloc (<em class="parameter"><code><a class="link" href="VipsObject.html" title="VipsObject"><span class="type">VipsObject</span></a> *object</code></em>,
 
294
             <em class="parameter"><code><span class="type">size_t</span> size</code></em>);</pre>
 
295
<p>g_malloc() local to <em class="parameter"><code>object</code></em>
 
296
, that is, the memory will be automatically 
 
297
freed for you when the object is closed. If <em class="parameter"><code>object</code></em>
 
298
 is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, you need to 
 
299
free the memory explicitly with <a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</p>
 
300
<p>This function cannot fail. See <a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a> if you are 
 
301
allocating large amounts of memory.</p>
 
302
<p>See also: <a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a>.</p>
 
303
<div class="refsect3">
 
304
<a name="id-1.2.10.8.7.7"></a><h4>Parameters</h4>
 
305
<div class="informaltable"><table width="100%" border="0">
 
306
<colgroup>
 
307
<col width="150px" class="parameters_name">
 
308
<col class="parameters_description">
 
309
<col width="200px" class="parameters_annotations">
 
310
</colgroup>
 
311
<tbody>
 
312
<tr>
 
313
<td class="parameter_name"><p>object</p></td>
 
314
<td class="parameter_description"><p>allocate memory local to this <a class="link" href="VipsObject.html" title="VipsObject"><span class="type">VipsObject</span></a>, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
 
315
<td class="parameter_annotations"> </td>
 
316
</tr>
 
317
<tr>
 
318
<td class="parameter_name"><p>size</p></td>
 
319
<td class="parameter_description"><p>number of bytes to allocate</p></td>
 
320
<td class="parameter_annotations"> </td>
 
321
</tr>
 
322
</tbody>
 
323
</table></div>
 
324
</div>
 
325
<div class="refsect3">
 
326
<a name="id-1.2.10.8.7.8"></a><h4>Returns</h4>
 
327
<p> a pointer to the allocated memory</p>
 
328
<p></p>
 
329
</div>
 
330
</div>
 
331
<hr>
 
332
<div class="refsect2">
 
333
<a name="vips-strdup"></a><h3>vips_strdup ()</h3>
 
334
<pre class="programlisting"><span class="returnvalue">char</span> *
 
335
vips_strdup (<em class="parameter"><code><a class="link" href="VipsObject.html" title="VipsObject"><span class="type">VipsObject</span></a> *object</code></em>,
 
336
             <em class="parameter"><code>const <span class="type">char</span> *str</code></em>);</pre>
 
337
<p>g_strdup() a string. When <em class="parameter"><code>object</code></em>
 
338
 is freed, the string will be freed for
 
339
you.  If <em class="parameter"><code>object</code></em>
 
340
 is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, you need to 
 
341
free the memory explicitly with <a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</p>
 
342
<p>This function cannot fail. </p>
 
343
<p>See also: <a class="link" href="libvips-memory.html#vips-malloc" title="vips_malloc ()"><code class="function">vips_malloc()</code></a>.</p>
 
344
<div class="refsect3">
 
345
<a name="id-1.2.10.8.8.7"></a><h4>Parameters</h4>
 
346
<div class="informaltable"><table width="100%" border="0">
 
347
<colgroup>
 
348
<col width="150px" class="parameters_name">
 
349
<col class="parameters_description">
 
350
<col width="200px" class="parameters_annotations">
 
351
</colgroup>
 
352
<tbody>
 
353
<tr>
 
354
<td class="parameter_name"><p>object</p></td>
 
355
<td class="parameter_description"><p>allocate memory local to this <a class="link" href="VipsObject.html" title="VipsObject"><span class="type">VipsObject</span></a>, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
 
356
<td class="parameter_annotations"> </td>
 
357
</tr>
 
358
<tr>
 
359
<td class="parameter_name"><p>str</p></td>
 
360
<td class="parameter_description"><p>string to copy</p></td>
 
361
<td class="parameter_annotations"> </td>
 
362
</tr>
 
363
</tbody>
 
364
</table></div>
 
365
</div>
 
366
<div class="refsect3">
 
367
<a name="id-1.2.10.8.8.8"></a><h4>Returns</h4>
 
368
<p> a pointer to the allocated memory</p>
 
369
<p></p>
 
370
</div>
 
371
</div>
 
372
<hr>
 
373
<div class="refsect2">
 
374
<a name="vips-free"></a><h3>vips_free ()</h3>
 
375
<pre class="programlisting"><span class="returnvalue">int</span>
 
376
vips_free (<em class="parameter"><code><span class="type">void</span> *buf</code></em>);</pre>
 
377
<p>Frees memory with <a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a> and returns 0. Handy for callbacks.</p>
 
378
<p>See also: <a class="link" href="libvips-memory.html#vips-malloc" title="vips_malloc ()"><code class="function">vips_malloc()</code></a>.</p>
 
379
<div class="refsect3">
 
380
<a name="id-1.2.10.8.9.6"></a><h4>Parameters</h4>
 
381
<div class="informaltable"><table width="100%" border="0">
 
382
<colgroup>
 
383
<col width="150px" class="parameters_name">
 
384
<col class="parameters_description">
 
385
<col width="200px" class="parameters_annotations">
 
386
</colgroup>
 
387
<tbody><tr>
 
388
<td class="parameter_name"><p>buf</p></td>
 
389
<td class="parameter_description"><p>memory to free</p></td>
 
390
<td class="parameter_annotations"> </td>
 
391
</tr></tbody>
 
392
</table></div>
 
393
</div>
 
394
<div class="refsect3">
 
395
<a name="id-1.2.10.8.9.7"></a><h4>Returns</h4>
 
396
<p> 0</p>
 
397
<p></p>
 
398
</div>
 
399
</div>
 
400
<hr>
 
401
<div class="refsect2">
 
402
<a name="vips-tracked-free"></a><h3>vips_tracked_free ()</h3>
 
403
<pre class="programlisting"><span class="returnvalue">void</span>
 
404
vips_tracked_free (<em class="parameter"><code><span class="type">void</span> *s</code></em>);</pre>
 
405
<p>Only use it to free
 
406
memory that was previously allocated with <a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a> with a 
 
407
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> first argument.</p>
 
408
<p>See also: <a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a>.</p>
 
409
<div class="refsect3">
 
410
<a name="id-1.2.10.8.10.6"></a><h4>Parameters</h4>
 
411
<div class="informaltable"><table width="100%" border="0">
 
412
<colgroup>
 
413
<col width="150px" class="parameters_name">
 
414
<col class="parameters_description">
 
415
<col width="200px" class="parameters_annotations">
 
416
</colgroup>
 
417
<tbody><tr>
 
418
<td class="parameter_name"><p>s</p></td>
 
419
<td class="parameter_description"><p>memory to free</p></td>
 
420
<td class="parameter_annotations"> </td>
 
421
</tr></tbody>
 
422
</table></div>
 
423
</div>
 
424
</div>
 
425
<hr>
 
426
<div class="refsect2">
 
427
<a name="vips-tracked-malloc"></a><h3>vips_tracked_malloc ()</h3>
 
428
<pre class="programlisting"><span class="returnvalue">void</span> *
 
429
vips_tracked_malloc (<em class="parameter"><code><span class="type">size_t</span> size</code></em>);</pre>
 
430
<p>Allocate an area of memory that will be tracked by <a class="link" href="libvips-memory.html#vips-tracked-get-mem" title="vips_tracked_get_mem ()"><code class="function">vips_tracked_get_mem()</code></a>
 
431
and friends. </p>
 
432
<p>If allocation fails, <a class="link" href="libvips-memory.html#vips-malloc" title="vips_malloc ()"><code class="function">vips_malloc()</code></a> returns <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> and 
 
433
sets an error message.</p>
 
434
<p>You must only free the memory returned with <a class="link" href="libvips-memory.html#vips-tracked-free" title="vips_tracked_free ()"><code class="function">vips_tracked_free()</code></a>.</p>
 
435
<p>See also: <a class="link" href="libvips-memory.html#vips-tracked-free" title="vips_tracked_free ()"><code class="function">vips_tracked_free()</code></a>, <a class="link" href="libvips-memory.html#vips-malloc" title="vips_malloc ()"><code class="function">vips_malloc()</code></a>.</p>
 
436
<div class="refsect3">
 
437
<a name="id-1.2.10.8.11.8"></a><h4>Parameters</h4>
 
438
<div class="informaltable"><table width="100%" border="0">
 
439
<colgroup>
 
440
<col width="150px" class="parameters_name">
 
441
<col class="parameters_description">
 
442
<col width="200px" class="parameters_annotations">
 
443
</colgroup>
 
444
<tbody><tr>
 
445
<td class="parameter_name"><p>size</p></td>
 
446
<td class="parameter_description"><p>number of bytes to allocate</p></td>
 
447
<td class="parameter_annotations"> </td>
 
448
</tr></tbody>
 
449
</table></div>
 
450
</div>
 
451
<div class="refsect3">
 
452
<a name="id-1.2.10.8.11.9"></a><h4>Returns</h4>
 
453
<p> a pointer to the allocated memory, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.</p>
 
454
<p></p>
 
455
</div>
 
456
</div>
 
457
<hr>
 
458
<div class="refsect2">
 
459
<a name="vips-tracked-get-mem"></a><h3>vips_tracked_get_mem ()</h3>
 
460
<pre class="programlisting"><span class="returnvalue">size_t</span>
 
461
vips_tracked_get_mem (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
 
462
<p>Returns the number of bytes currently allocated via <a class="link" href="libvips-memory.html#vips-malloc" title="vips_malloc ()"><code class="function">vips_malloc()</code></a> and
335
463
friends. vips uses this figure to decide when to start dropping cache, see
336
 
<a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a>.
337
 
</p>
338
 
<div class="variablelist"><table border="0" class="variablelist">
339
 
<colgroup>
340
 
<col align="left" valign="top">
341
 
<col>
342
 
</colgroup>
343
 
<tbody><tr>
344
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
345
 
<td>the number of currently allocated bytes</td>
346
 
</tr></tbody>
347
 
</table></div>
348
 
</div>
349
 
<hr>
350
 
<div class="refsect2">
351
 
<a name="vips-tracked-get-mem-highwater"></a><h3>vips_tracked_get_mem_highwater ()</h3>
352
 
<pre class="programlisting"><span class="returnvalue">size_t</span>              vips_tracked_get_mem_highwater      (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
353
 
<p>
354
 
Returns the largest number of bytes simultaneously allocated via 
355
 
<a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a>. Handy for estimating max memory requirements for a
356
 
program.
357
 
</p>
358
 
<div class="variablelist"><table border="0" class="variablelist">
359
 
<colgroup>
360
 
<col align="left" valign="top">
361
 
<col>
362
 
</colgroup>
363
 
<tbody><tr>
364
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
365
 
<td>the largest number of currently allocated bytes</td>
366
 
</tr></tbody>
367
 
</table></div>
368
 
</div>
369
 
<hr>
370
 
<div class="refsect2">
371
 
<a name="vips-tracked-get-allocs"></a><h3>vips_tracked_get_allocs ()</h3>
372
 
<pre class="programlisting"><span class="returnvalue">int</span>                 vips_tracked_get_allocs             (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
373
 
<p>
374
 
Returns the number of active allocations.
375
 
</p>
376
 
<div class="variablelist"><table border="0" class="variablelist">
377
 
<colgroup>
378
 
<col align="left" valign="top">
379
 
<col>
380
 
</colgroup>
381
 
<tbody><tr>
382
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
383
 
<td>the number of active allocations</td>
384
 
</tr></tbody>
385
 
</table></div>
386
 
</div>
387
 
<hr>
388
 
<div class="refsect2">
389
 
<a name="vips-tracked-open"></a><h3>vips_tracked_open ()</h3>
390
 
<pre class="programlisting"><span class="returnvalue">int</span>                 vips_tracked_open                   (<em class="parameter"><code>const <span class="type">char</span> *pathname</code></em>,
391
 
                                                         <em class="parameter"><code><span class="type">int</span> flags</code></em>,
392
 
                                                         <em class="parameter"><code>...</code></em>);</pre>
393
 
<p>
394
 
Exactly as open(2), but the number of files current open via
395
 
<a class="link" href="libvips-memory.html#vips-tracked-open" title="vips_tracked_open ()"><code class="function">vips_tracked_open()</code></a> is available via <a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()"><code class="function">vips_tracked_get_files()</code></a>. This is used
396
 
by the vips operation cache to drop cache when the number of files
397
 
available is low.
398
 
</p>
399
 
<p>
400
 
You must only close the file descriptor with <a class="link" href="libvips-memory.html#vips-tracked-close" title="vips_tracked_close ()"><code class="function">vips_tracked_close()</code></a>.
401
 
</p>
402
 
<p>
403
 
See also: <a class="link" href="libvips-memory.html#vips-tracked-close" title="vips_tracked_close ()"><code class="function">vips_tracked_close()</code></a>, <a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()"><code class="function">vips_tracked_get_files()</code></a>.
404
 
</p>
405
 
<div class="variablelist"><table border="0" class="variablelist">
406
 
<colgroup>
407
 
<col align="left" valign="top">
408
 
<col>
409
 
</colgroup>
410
 
<tbody>
411
 
<tr>
412
 
<td><p><span class="term"><em class="parameter"><code>pathname</code></em> :</span></p></td>
413
 
<td>name of file to open</td>
414
 
</tr>
415
 
<tr>
416
 
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
417
 
<td>flags for <code class="function">open()</code>
418
 
</td>
419
 
</tr>
420
 
<tr>
421
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
422
 
<td>a file descriptor, or -1 on error.</td>
423
 
</tr>
424
 
</tbody>
425
 
</table></div>
426
 
</div>
427
 
<hr>
428
 
<div class="refsect2">
429
 
<a name="vips-tracked-close"></a><h3>vips_tracked_close ()</h3>
430
 
<pre class="programlisting"><span class="returnvalue">int</span>                 vips_tracked_close                  (<em class="parameter"><code><span class="type">int</span> fd</code></em>);</pre>
431
 
<p>
432
 
Exactly as close(2), but update the number of files currently open via
433
 
<a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()"><code class="function">vips_tracked_get_files()</code></a>. This is used
434
 
by the vips operation cache to drop cache when the number of files
435
 
available is low.
436
 
</p>
437
 
<p>
438
 
You must only close file descriptors opened with <a class="link" href="libvips-memory.html#vips-tracked-open" title="vips_tracked_open ()"><code class="function">vips_tracked_open()</code></a>.
439
 
</p>
440
 
<p>
441
 
See also: <a class="link" href="libvips-memory.html#vips-tracked-open" title="vips_tracked_open ()"><code class="function">vips_tracked_open()</code></a>, <a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()"><code class="function">vips_tracked_get_files()</code></a>.
442
 
</p>
443
 
<div class="variablelist"><table border="0" class="variablelist">
444
 
<colgroup>
445
 
<col align="left" valign="top">
446
 
<col>
447
 
</colgroup>
448
 
<tbody>
449
 
<tr>
450
 
<td><p><span class="term"><em class="parameter"><code>fd</code></em> :</span></p></td>
451
 
<td>file to <code class="function">close()</code>
452
 
</td>
453
 
</tr>
454
 
<tr>
455
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
456
 
<td>a file descriptor, or -1 on error.</td>
457
 
</tr>
458
 
</tbody>
459
 
</table></div>
460
 
</div>
461
 
<hr>
462
 
<div class="refsect2">
463
 
<a name="vips-tracked-get-files"></a><h3>vips_tracked_get_files ()</h3>
464
 
<pre class="programlisting"><span class="returnvalue">int</span>                 vips_tracked_get_files              (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
465
 
<p>
466
 
Returns the number of open files.
467
 
</p>
468
 
<div class="variablelist"><table border="0" class="variablelist">
469
 
<colgroup>
470
 
<col align="left" valign="top">
471
 
<col>
472
 
</colgroup>
473
 
<tbody><tr>
474
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
475
 
<td>the number of open files</td>
476
 
</tr></tbody>
477
 
</table></div>
478
 
</div>
 
464
<a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a>.</p>
 
465
<div class="refsect3">
 
466
<a name="id-1.2.10.8.12.5"></a><h4>Returns</h4>
 
467
<p> the number of currently allocated bytes</p>
 
468
<p></p>
 
469
</div>
 
470
</div>
 
471
<hr>
 
472
<div class="refsect2">
 
473
<a name="vips-tracked-get-mem-highwater"></a><h3>vips_tracked_get_mem_highwater ()</h3>
 
474
<pre class="programlisting"><span class="returnvalue">size_t</span>
 
475
vips_tracked_get_mem_highwater (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
 
476
<p>Returns the largest number of bytes simultaneously allocated via 
 
477
<a class="link" href="libvips-memory.html#vips-tracked-malloc" title="vips_tracked_malloc ()"><code class="function">vips_tracked_malloc()</code></a>. Handy for estimating max memory requirements for a
 
478
program.</p>
 
479
<div class="refsect3">
 
480
<a name="id-1.2.10.8.13.5"></a><h4>Returns</h4>
 
481
<p> the largest number of currently allocated bytes</p>
 
482
<p></p>
 
483
</div>
 
484
</div>
 
485
<hr>
 
486
<div class="refsect2">
 
487
<a name="vips-tracked-get-allocs"></a><h3>vips_tracked_get_allocs ()</h3>
 
488
<pre class="programlisting"><span class="returnvalue">int</span>
 
489
vips_tracked_get_allocs (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
 
490
<p>Returns the number of active allocations.</p>
 
491
<div class="refsect3">
 
492
<a name="id-1.2.10.8.14.5"></a><h4>Returns</h4>
 
493
<p> the number of active allocations</p>
 
494
<p></p>
 
495
</div>
 
496
</div>
 
497
<hr>
 
498
<div class="refsect2">
 
499
<a name="vips-tracked-open"></a><h3>vips_tracked_open ()</h3>
 
500
<pre class="programlisting"><span class="returnvalue">int</span>
 
501
vips_tracked_open (<em class="parameter"><code>const <span class="type">char</span> *pathname</code></em>,
 
502
                   <em class="parameter"><code><span class="type">int</span> flags</code></em>,
 
503
                   <em class="parameter"><code>...</code></em>);</pre>
 
504
<p>Exactly as open(2), but the number of files current open via
 
505
<a class="link" href="libvips-memory.html#vips-tracked-open" title="vips_tracked_open ()"><code class="function">vips_tracked_open()</code></a> is available via <a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()"><code class="function">vips_tracked_get_files()</code></a>. This is used
 
506
by the vips operation cache to drop cache when the number of files
 
507
available is low.</p>
 
508
<p>You must only close the file descriptor with <a class="link" href="libvips-memory.html#vips-tracked-close" title="vips_tracked_close ()"><code class="function">vips_tracked_close()</code></a>.</p>
 
509
<p>See also: <a class="link" href="libvips-memory.html#vips-tracked-close" title="vips_tracked_close ()"><code class="function">vips_tracked_close()</code></a>, <a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()"><code class="function">vips_tracked_get_files()</code></a>.</p>
 
510
<div class="refsect3">
 
511
<a name="id-1.2.10.8.15.7"></a><h4>Parameters</h4>
 
512
<div class="informaltable"><table width="100%" border="0">
 
513
<colgroup>
 
514
<col width="150px" class="parameters_name">
 
515
<col class="parameters_description">
 
516
<col width="200px" class="parameters_annotations">
 
517
</colgroup>
 
518
<tbody>
 
519
<tr>
 
520
<td class="parameter_name"><p>pathname</p></td>
 
521
<td class="parameter_description"><p>name of file to open</p></td>
 
522
<td class="parameter_annotations"> </td>
 
523
</tr>
 
524
<tr>
 
525
<td class="parameter_name"><p>flags</p></td>
 
526
<td class="parameter_description"><p>flags for <code class="function">open()</code></p></td>
 
527
<td class="parameter_annotations"> </td>
 
528
</tr>
 
529
</tbody>
 
530
</table></div>
 
531
</div>
 
532
<div class="refsect3">
 
533
<a name="id-1.2.10.8.15.8"></a><h4>Returns</h4>
 
534
<p> a file descriptor, or -1 on error.</p>
 
535
<p></p>
 
536
</div>
 
537
</div>
 
538
<hr>
 
539
<div class="refsect2">
 
540
<a name="vips-tracked-close"></a><h3>vips_tracked_close ()</h3>
 
541
<pre class="programlisting"><span class="returnvalue">int</span>
 
542
vips_tracked_close (<em class="parameter"><code><span class="type">int</span> fd</code></em>);</pre>
 
543
<p>Exactly as close(2), but update the number of files currently open via
 
544
<a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()"><code class="function">vips_tracked_get_files()</code></a>. This is used
 
545
by the vips operation cache to drop cache when the number of files
 
546
available is low.</p>
 
547
<p>You must only close file descriptors opened with <a class="link" href="libvips-memory.html#vips-tracked-open" title="vips_tracked_open ()"><code class="function">vips_tracked_open()</code></a>.</p>
 
548
<p>See also: <a class="link" href="libvips-memory.html#vips-tracked-open" title="vips_tracked_open ()"><code class="function">vips_tracked_open()</code></a>, <a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()"><code class="function">vips_tracked_get_files()</code></a>.</p>
 
549
<div class="refsect3">
 
550
<a name="id-1.2.10.8.16.7"></a><h4>Parameters</h4>
 
551
<div class="informaltable"><table width="100%" border="0">
 
552
<colgroup>
 
553
<col width="150px" class="parameters_name">
 
554
<col class="parameters_description">
 
555
<col width="200px" class="parameters_annotations">
 
556
</colgroup>
 
557
<tbody><tr>
 
558
<td class="parameter_name"><p>fd</p></td>
 
559
<td class="parameter_description"><p>file to <code class="function">close()</code></p></td>
 
560
<td class="parameter_annotations"> </td>
 
561
</tr></tbody>
 
562
</table></div>
 
563
</div>
 
564
<div class="refsect3">
 
565
<a name="id-1.2.10.8.16.8"></a><h4>Returns</h4>
 
566
<p> a file descriptor, or -1 on error.</p>
 
567
<p></p>
 
568
</div>
 
569
</div>
 
570
<hr>
 
571
<div class="refsect2">
 
572
<a name="vips-tracked-get-files"></a><h3>vips_tracked_get_files ()</h3>
 
573
<pre class="programlisting"><span class="returnvalue">int</span>
 
574
vips_tracked_get_files (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
 
575
<p>Returns the number of open files.</p>
 
576
<div class="refsect3">
 
577
<a name="id-1.2.10.8.17.5"></a><h4>Returns</h4>
 
578
<p> the number of open files</p>
 
579
<p></p>
 
580
</div>
 
581
</div>
 
582
</div>
 
583
<div class="refsect1">
 
584
<a name="libvips-memory.other_details"></a><h2>Types and Values</h2>
479
585
</div>
480
586
</div>
481
587
<div class="footer">
482
588
<hr>
483
 
          Generated by GTK-Doc V1.19</div>
 
589
          Generated by GTK-Doc V1.20</div>
484
590
</body>
485
591
</html>
 
 
b'\\ No newline at end of file'