]> git.ozlabs.org Git - ponghero.git/blob - ccan/ccan_tools/talloc/talloc.3
Add web pages.
[ponghero.git] / ccan / ccan_tools / talloc / talloc.3
1 .\"     Title: talloc
2 .\"    Author: 
3 .\" Generator: DocBook XSL Stylesheets v1.72.0 <http://docbook.sf.net/>
4 .\"      Date: 12/20/2007
5 .\"    Manual: 
6 .\"    Source: 
7 .\"
8 .TH "TALLOC" "3" "12/20/2007" "" ""
9 .\" disable hyphenation
10 .nh
11 .\" disable justification (adjust text to left margin only)
12 .ad l
13 .SH "NAME"
14 talloc \- hierarchical reference counted memory pool system with destructors
15 .SH "SYNOPSIS"
16 .sp
17 .RS 4
18 .nf
19 #include <talloc/talloc.h>
20 .fi
21 .RE
22 .SH "DESCRIPTION"
23 .PP
24 If you are used to talloc from Samba3 then please read this carefully, as talloc has changed a lot.
25 .PP
26 The new talloc is a hierarchical, reference counted memory pool system with destructors. Quite a mouthful really, but not too bad once you get used to it.
27 .PP
28 Perhaps the biggest change from Samba3 is that there is no distinction between a "talloc context" and a "talloc pointer". Any pointer returned from talloc() is itself a valid talloc context. This means you can do this:
29 .sp
30 .RS 4
31 .nf
32     struct foo *X = talloc(mem_ctx, struct foo);
33     X\->name = talloc_strdup(X, "foo");
34     
35 .fi
36 .RE
37 .PP
38 and the pointer
39 X\->name
40 would be a "child" of the talloc context
41 X
42 which is itself a child of
43 mem_ctx. So if you do
44 talloc_free(mem_ctx)
45 then it is all destroyed, whereas if you do
46 talloc_free(X)
47 then just
48 X
49 and
50 X\->name
51 are destroyed, and if you do
52 talloc_free(X\->name)
53 then just the name element of
54 X
55 is destroyed.
56 .PP
57 If you think about this, then what this effectively gives you is an n\-ary tree, where you can free any part of the tree with talloc_free().
58 .PP
59 If you find this confusing, then I suggest you run the
60 testsuite
61 program to watch talloc in action. You may also like to add your own tests to
62 testsuite.c
63 to clarify how some particular situation is handled.
64 .SH "TALLOC API"
65 .PP
66 The following is a complete guide to the talloc API. Read it all at least twice.
67 .SS "(type *)talloc(const void *ctx, type);"
68 .PP
69 The talloc() macro is the core of the talloc library. It takes a memory
70 \fIctx\fR
71 and a
72 \fItype\fR, and returns a pointer to a new area of memory of the given
73 \fItype\fR.
74 .PP
75 The returned pointer is itself a talloc context, so you can use it as the
76 \fIctx\fR
77 argument to more calls to talloc() if you wish.
78 .PP
79 The returned pointer is a "child" of the supplied context. This means that if you talloc_free() the
80 \fIctx\fR
81 then the new child disappears as well. Alternatively you can free just the child.
82 .PP
83 The
84 \fIctx\fR
85 argument to talloc() can be NULL, in which case a new top level context is created.
86 .SS "void *talloc_size(const void *ctx, size_t size);"
87 .PP
88 The function talloc_size() should be used when you don't have a convenient type to pass to talloc(). Unlike talloc(), it is not type safe (as it returns a void *), so you are on your own for type checking.
89 .SS "(typeof(ptr)) talloc_ptrtype(const void *ctx, ptr);"
90 .PP
91 The talloc_ptrtype() macro should be used when you have a pointer and want to allocate memory to point at with this pointer. When compiling with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_size() and talloc_get_name() will return the current location in the source file. and not the type.
92 .SS "int talloc_free(void *ptr);"
93 .PP
94 The talloc_free() function frees a piece of talloc memory, and all its children. You can call talloc_free() on any pointer returned by talloc().
95 .PP
96 The return value of talloc_free() indicates success or failure, with 0 returned for success and \-1 for failure. The only possible failure condition is if
97 \fIptr\fR
98 had a destructor attached to it and the destructor returned \-1. See
99 \(lqtalloc_set_destructor()\(rq
100 for details on destructors.
101 .PP
102 If this pointer has an additional parent when talloc_free() is called then the memory is not actually released, but instead the most recently established parent is destroyed. See
103 \(lqtalloc_reference()\(rq
104 for details on establishing additional parents.
105 .PP
106 For more control on which parent is removed, see
107 \(lqtalloc_unlink()\(rq.
108 .PP
109 talloc_free() operates recursively on its children.
110 .SS "void *talloc_reference(const void *ctx, const void *ptr);"
111 .PP
112 The talloc_reference() function makes
113 \fIctx\fR
114 an additional parent of
115 \fIptr\fR.
116 .PP
117 The return value of talloc_reference() is always the original pointer
118 \fIptr\fR, unless talloc ran out of memory in creating the reference in which case it will return NULL (each additional reference consumes around 48 bytes of memory on intel x86 platforms).
119 .PP
120 If
121 \fIptr\fR
122 is NULL, then the function is a no\-op, and simply returns NULL.
123 .PP
124 After creating a reference you can free it in one of the following ways:
125 .PP
126
127 .sp
128 .RS 4
129 \h'-04'\(bu\h'+03'you can talloc_free() any parent of the original pointer. That will reduce the number of parents of this pointer by 1, and will cause this pointer to be freed if it runs out of parents.
130 .RE
131 .sp
132 .RS 4
133 \h'-04'\(bu\h'+03'you can talloc_free() the pointer itself. That will destroy the most recently established parent to the pointer and leave the pointer as a child of its current parent.
134 .RE
135 .sp
136 .RE
137 .PP
138 For more control on which parent to remove, see
139 \(lqtalloc_unlink()\(rq.
140 .SS "int talloc_unlink(const void *ctx, const void *ptr);"
141 .PP
142 The talloc_unlink() function removes a specific parent from
143 \fIptr\fR. The
144 \fIctx\fR
145 passed must either be a context used in talloc_reference() with this pointer, or must be a direct parent of ptr.
146 .PP
147 Note that if the parent has already been removed using talloc_free() then this function will fail and will return \-1. Likewise, if
148 \fIptr\fR
149 is NULL, then the function will make no modifications and return \-1.
150 .PP
151 Usually you can just use talloc_free() instead of talloc_unlink(), but sometimes it is useful to have the additional control on which parent is removed.
152 .SS "void talloc_set_destructor(const void *ptr, int (*destructor)(void *));"
153 .PP
154 The function talloc_set_destructor() sets the
155 \fIdestructor\fR
156 for the pointer
157 \fIptr\fR. A
158 \fIdestructor\fR
159 is a function that is called when the memory used by a pointer is about to be released. The destructor receives
160 \fIptr\fR
161 as an argument, and should return 0 for success and \-1 for failure.
162 .PP
163 The
164 \fIdestructor\fR
165 can do anything it wants to, including freeing other pieces of memory. A common use for destructors is to clean up operating system resources (such as open file descriptors) contained in the structure the destructor is placed on.
166 .PP
167 You can only place one destructor on a pointer. If you need more than one destructor then you can create a zero\-length child of the pointer and place an additional destructor on that.
168 .PP
169 To remove a destructor call talloc_set_destructor() with NULL for the destructor.
170 .PP
171 If your destructor attempts to talloc_free() the pointer that it is the destructor for then talloc_free() will return \-1 and the free will be ignored. This would be a pointless operation anyway, as the destructor is only called when the memory is just about to go away.
172 .SS "int talloc_increase_ref_count(const void *\fIptr\fR);"
173 .PP
174 The talloc_increase_ref_count(\fIptr\fR) function is exactly equivalent to:
175 .sp
176 .RS 4
177 .nf
178 talloc_reference(NULL, ptr);
179 .fi
180 .RE
181 .PP
182 You can use either syntax, depending on which you think is clearer in your code.
183 .PP
184 It returns 0 on success and \-1 on failure.
185 .SS "size_t talloc_reference_count(const void *\fIptr\fR);"
186 .PP
187 Return the number of references to the pointer.
188 .SS "void talloc_set_name(const void *ptr, const char *fmt, ...);"
189 .PP
190 Each talloc pointer has a "name". The name is used principally for debugging purposes, although it is also possible to set and get the name on a pointer in as a way of "marking" pointers in your code.
191 .PP
192 The main use for names on pointer is for "talloc reports". See
193 \(lqtalloc_report_depth_cb()\(rq,
194 \(lqtalloc_report_depth_file()\(rq,
195 \(lqtalloc_report()\(rq
196 \(lqtalloc_report()\(rq
197 and
198 \(lqtalloc_report_full()\(rq
199 for details. Also see
200 \(lqtalloc_enable_leak_report()\(rq
201 and
202 \(lqtalloc_enable_leak_report_full()\(rq.
203 .PP
204 The talloc_set_name() function allocates memory as a child of the pointer. It is logically equivalent to:
205 .sp
206 .RS 4
207 .nf
208 talloc_set_name_const(ptr, talloc_asprintf(ptr, fmt, ...));
209 .fi
210 .RE
211 .PP
212 Note that multiple calls to talloc_set_name() will allocate more memory without releasing the name. All of the memory is released when the ptr is freed using talloc_free().
213 .SS "void talloc_set_name_const(const void *\fIptr\fR, const char *\fIname\fR);"
214 .PP
215 The function talloc_set_name_const() is just like talloc_set_name(), but it takes a string constant, and is much faster. It is extensively used by the "auto naming" macros, such as talloc_p().
216 .PP
217 This function does not allocate any memory. It just copies the supplied pointer into the internal representation of the talloc ptr. This means you must not pass a
218 \fIname\fR
219 pointer to memory that will disappear before
220 \fIptr\fR
221 is freed with talloc_free().
222 .SS "void *talloc_named(const void *\fIctx\fR, size_t \fIsize\fR, const char *\fIfmt\fR, ...);"
223 .PP
224 The talloc_named() function creates a named talloc pointer. It is equivalent to:
225 .sp
226 .RS 4
227 .nf
228 ptr = talloc_size(ctx, size);
229 talloc_set_name(ptr, fmt, ....);
230 .fi
231 .RE
232 .SS "void *talloc_named_const(const void *\fIctx\fR, size_t \fIsize\fR, const char *\fIname\fR);"
233 .PP
234 This is equivalent to:
235 .sp
236 .RS 4
237 .nf
238 ptr = talloc_size(ctx, size);
239 talloc_set_name_const(ptr, name);
240 .fi
241 .RE
242 .SS "const char *talloc_get_name(const void *\fIptr\fR);"
243 .PP
244 This returns the current name for the given talloc pointer,
245 \fIptr\fR. See
246 \(lqtalloc_set_name()\(rq
247 for details.
248 .SS "void *talloc_init(const char *\fIfmt\fR, ...);"
249 .PP
250 This function creates a zero length named talloc context as a top level context. It is equivalent to:
251 .sp
252 .RS 4
253 .nf
254 talloc_named(NULL, 0, fmt, ...);
255 .fi
256 .RE
257 .SS "void *talloc_new(void *\fIctx\fR);"
258 .PP
259 This is a utility macro that creates a new memory context hanging off an exiting context, automatically naming it "talloc_new: __location__" where __location__ is the source line it is called from. It is particularly useful for creating a new temporary working context.
260 .SS "(\fItype\fR *)talloc_realloc(const void *\fIctx\fR, void *\fIptr\fR, \fItype\fR, \fIcount\fR);"
261 .PP
262 The talloc_realloc() macro changes the size of a talloc pointer. It has the following equivalences:
263 .sp
264 .RS 4
265 .nf
266 talloc_realloc(ctx, NULL, type, 1) ==> talloc(ctx, type);
267 talloc_realloc(ctx, ptr, type, 0)  ==> talloc_free(ptr);
268 .fi
269 .RE
270 .PP
271 The
272 \fIctx\fR
273 argument is only used if
274 \fIptr\fR
275 is not NULL, otherwise it is ignored.
276 .PP
277 talloc_realloc() returns the new pointer, or NULL on failure. The call will fail either due to a lack of memory, or because the pointer has more than one parent (see
278 \(lqtalloc_reference()\(rq).
279 .SS "void *talloc_realloc_size(const void *ctx, void *ptr, size_t size);"
280 .PP
281 the talloc_realloc_size() function is useful when the type is not known so the type\-safe talloc_realloc() cannot be used.
282 .SS "TYPE *talloc_steal(const void *\fInew_ctx\fR, const TYPE *\fIptr\fR);"
283 .PP
284 The talloc_steal() function changes the parent context of a talloc pointer. It is typically used when the context that the pointer is currently a child of is going to be freed and you wish to keep the memory for a longer time.
285 .PP
286 The talloc_steal() function returns the pointer that you pass it. It does not have any failure modes.
287 .PP
288 NOTE: It is possible to produce loops in the parent/child relationship if you are not careful with talloc_steal(). No guarantees are provided as to your sanity or the safety of your data if you do this.
289 .SS "TYPE *talloc_move(const void *\fInew_ctx\fR, TYPE **\fIptr\fR);"
290 .PP
291 The talloc_move() function is a wrapper around talloc_steal() which zeros the source pointer after the move. This avoids a potential source of bugs where a programmer leaves a pointer in two structures, and uses the pointer from the old structure after it has been moved to a new one.
292 .SS "size_t talloc_total_size(const void *\fIptr\fR);"
293 .PP
294 The talloc_total_size() function returns the total size in bytes used by this pointer and all child pointers. Mostly useful for debugging.
295 .PP
296 Passing NULL is allowed, but it will only give a meaningful result if talloc_enable_leak_report() or talloc_enable_leak_report_full() has been called.
297 .SS "size_t talloc_total_blocks(const void *\fIptr\fR);"
298 .PP
299 The talloc_total_blocks() function returns the total memory block count used by this pointer and all child pointers. Mostly useful for debugging.
300 .PP
301 Passing NULL is allowed, but it will only give a meaningful result if talloc_enable_leak_report() or talloc_enable_leak_report_full() has been called.
302 .SS "void talloc_report(const void *ptr, FILE *f);"
303 .PP
304 The talloc_report() function prints a summary report of all memory used by
305 \fIptr\fR. One line of report is printed for each immediate child of ptr, showing the total memory and number of blocks used by that child.
306 .PP
307 You can pass NULL for the pointer, in which case a report is printed for the top level memory context, but only if talloc_enable_leak_report() or talloc_enable_leak_report_full() has been called.
308 .SS "void talloc_report_full(const void *\fIptr\fR, FILE *\fIf\fR);"
309 .PP
310 This provides a more detailed report than talloc_report(). It will recursively print the entire tree of memory referenced by the pointer. References in the tree are shown by giving the name of the pointer that is referenced.
311 .PP
312 You can pass NULL for the pointer, in which case a report is printed for the top level memory context, but only if talloc_enable_leak_report() or talloc_enable_leak_report_full() has been called.
313 .SS ""
314 .HP 28
315 .BI "void talloc_report_depth_cb(" "const\ void\ *ptr" ", " "int\ depth" ", " "int\ max_depth" ", " "void\ (*callback)(const\ void\ *ptr,\ int\ depth,\ int\ max_depth,\ int\ is_ref,\ void\ *priv)" ", " "void\ *priv" ");"
316 .PP
317 This provides a more flexible reports than talloc_report(). It will recursively call the callback for the entire tree of memory referenced by the pointer. References in the tree are passed with
318 \fIis_ref = 1\fR
319 and the pointer that is referenced.
320 .PP
321 You can pass NULL for the pointer, in which case a report is printed for the top level memory context, but only if talloc_enable_leak_report() or talloc_enable_leak_report_full() has been called.
322 .PP
323 The recursion is stopped when depth >= max_depth. max_depth = \-1 means only stop at leaf nodes.
324 .SS ""
325 .HP 30
326 .BI "void talloc_report_depth_file(" "const\ void\ *ptr" ", " "int\ depth" ", " "int\ max_depth" ", " "FILE\ *f" ");"
327 .PP
328 This provides a more flexible reports than talloc_report(). It will let you specify the depth and max_depth.
329 .SS "void talloc_enable_leak_report(void);"
330 .PP
331 This enables calling of talloc_report(NULL, stderr) when the program exits. In Samba4 this is enabled by using the \-\-leak\-report command line option.
332 .PP
333 For it to be useful, this function must be called before any other talloc function as it establishes a "null context" that acts as the top of the tree. If you don't call this function first then passing NULL to talloc_report() or talloc_report_full() won't give you the full tree printout.
334 .PP
335 Here is a typical talloc report:
336 .sp
337 .RS 4
338 .nf
339 talloc report on 'null_context' (total 267 bytes in 15 blocks)
340 libcli/auth/spnego_parse.c:55  contains   31 bytes in   2 blocks
341 libcli/auth/spnego_parse.c:55  contains   31 bytes in   2 blocks
342 iconv(UTF8,CP850)              contains   42 bytes in   2 blocks
343 libcli/auth/spnego_parse.c:55  contains   31 bytes in   2 blocks
344 iconv(CP850,UTF8)              contains   42 bytes in   2 blocks
345 iconv(UTF8,UTF\-16LE)           contains   45 bytes in   2 blocks
346 iconv(UTF\-16LE,UTF8)           contains   45 bytes in   2 blocks
347       
348 .fi
349 .RE
350 .SS "void talloc_enable_leak_report_full(void);"
351 .PP
352 This enables calling of talloc_report_full(NULL, stderr) when the program exits. In Samba4 this is enabled by using the \-\-leak\-report\-full command line option.
353 .PP
354 For it to be useful, this function must be called before any other talloc function as it establishes a "null context" that acts as the top of the tree. If you don't call this function first then passing NULL to talloc_report() or talloc_report_full() won't give you the full tree printout.
355 .PP
356 Here is a typical full report:
357 .sp
358 .RS 4
359 .nf
360 full talloc report on 'root' (total 18 bytes in 8 blocks)
361 p1               contains     18 bytes in   7 blocks (ref 0)
362     r1               contains     13 bytes in   2 blocks (ref 0)
363         reference to: p2
364     p2               contains      1 bytes in   1 blocks (ref 1)
365     x3               contains      1 bytes in   1 blocks (ref 0)
366     x2               contains      1 bytes in   1 blocks (ref 0)
367     x1               contains      1 bytes in   1 blocks (ref 0)
368       
369 .fi
370 .RE
371 .SS "(\fItype\fR *)talloc_zero(const void *\fIctx\fR, \fItype\fR);"
372 .PP
373 The talloc_zero() macro is equivalent to:
374 .sp
375 .RS 4
376 .nf
377 ptr = talloc(ctx, type);
378 if (ptr) memset(ptr, 0, sizeof(type));
379 .fi
380 .RE
381 .SS "void *talloc_zero_size(const void *\fIctx\fR, size_t \fIsize\fR)"
382 .PP
383 The talloc_zero_size() function is useful when you don't have a known type.
384 .SS "void *talloc_memdup(const void *\fIctx\fR, const void *\fIp\fR, size_t size);"
385 .PP
386 The talloc_memdup() function is equivalent to:
387 .sp
388 .RS 4
389 .nf
390 ptr = talloc_size(ctx, size);
391 if (ptr) memcpy(ptr, p, size);
392 .fi
393 .RE
394 .SS "char *talloc_strdup(const void *\fIctx\fR, const char *\fIp\fR);"
395 .PP
396 The talloc_strdup() function is equivalent to:
397 .sp
398 .RS 4
399 .nf
400 ptr = talloc_size(ctx, strlen(p)+1);
401 if (ptr) memcpy(ptr, p, strlen(p)+1);
402 .fi
403 .RE
404 .PP
405 This function sets the name of the new pointer to the passed string. This is equivalent to:
406 .sp
407 .RS 4
408 .nf
409 talloc_set_name_const(ptr, ptr)
410 .fi
411 .RE
412 .SS "char *talloc_strndup(const void *\fIt\fR, const char *\fIp\fR, size_t \fIn\fR);"
413 .PP
414 The talloc_strndup() function is the talloc equivalent of the C library function strndup(3).
415 .PP
416 This function sets the name of the new pointer to the passed string. This is equivalent to:
417 .sp
418 .RS 4
419 .nf
420 talloc_set_name_const(ptr, ptr)
421 .fi
422 .RE
423 .SS "char *talloc_append_string(const void *\fIt\fR, char *\fIorig\fR, const char *\fIappend\fR);"
424 .PP
425 The talloc_append_string() function appends the given formatted string to the given string.
426 .PP
427 This function sets the name of the new pointer to the new string. This is equivalent to:
428 .sp
429 .RS 4
430 .nf
431 talloc_set_name_const(ptr, ptr)
432 .fi
433 .RE
434 .SS "char *talloc_vasprintf(const void *\fIt\fR, const char *\fIfmt\fR, va_list \fIap\fR);"
435 .PP
436 The talloc_vasprintf() function is the talloc equivalent of the C library function vasprintf(3).
437 .PP
438 This function sets the name of the new pointer to the new string. This is equivalent to:
439 .sp
440 .RS 4
441 .nf
442 talloc_set_name_const(ptr, ptr)
443 .fi
444 .RE
445 .SS "char *talloc_asprintf(const void *\fIt\fR, const char *\fIfmt\fR, ...);"
446 .PP
447 The talloc_asprintf() function is the talloc equivalent of the C library function asprintf(3).
448 .PP
449 This function sets the name of the new pointer to the passed string. This is equivalent to:
450 .sp
451 .RS 4
452 .nf
453 talloc_set_name_const(ptr, ptr)
454 .fi
455 .RE
456 .SS "char *talloc_asprintf_append(char *s, const char *fmt, ...);"
457 .PP
458 The talloc_asprintf_append() function appends the given formatted string to the given string.
459 .PP
460 This function sets the name of the new pointer to the new string. This is equivalent to:
461 .sp
462 .RS 4
463 .nf
464 talloc_set_name_const(ptr, ptr)
465 .fi
466 .RE
467 .SS "(type *)talloc_array(const void *ctx, type, uint_t count);"
468 .PP
469 The talloc_array() macro is equivalent to:
470 .sp
471 .RS 4
472 .nf
473 (type *)talloc_size(ctx, sizeof(type) * count);
474 .fi
475 .RE
476 .PP
477 except that it provides integer overflow protection for the multiply, returning NULL if the multiply overflows.
478 .SS "void *talloc_array_size(const void *ctx, size_t size, uint_t count);"
479 .PP
480 The talloc_array_size() function is useful when the type is not known. It operates in the same way as talloc_array(), but takes a size instead of a type.
481 .SS "(typeof(ptr)) talloc_array_ptrtype(const void *ctx, ptr, uint_t count);"
482 .PP
483 The talloc_ptrtype() macro should be used when you have a pointer to an array and want to allocate memory of an array to point at with this pointer. When compiling with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_array_size() and talloc_get_name() will return the current location in the source file. and not the type.
484 .SS "void *talloc_realloc_fn(const void *ctx, void *ptr, size_t size)"
485 .PP
486 This is a non\-macro version of talloc_realloc(), which is useful as libraries sometimes want a realloc function pointer. A realloc(3) implementation encapsulates the functionality of malloc(3), free(3) and realloc(3) in one call, which is why it is useful to be able to pass around a single function pointer.
487 .SS "void *talloc_autofree_context(void);"
488 .PP
489 This is a handy utility function that returns a talloc context which will be automatically freed on program exit. This can be used to reduce the noise in memory leak reports.
490 .SS "void *talloc_check_name(const void *ptr, const char *name);"
491 .PP
492 This function checks if a pointer has the specified
493 \fIname\fR. If it does then the pointer is returned. It it doesn't then NULL is returned.
494 .SS "(type *)talloc_get_type(const void *ptr, type);"
495 .PP
496 This macro allows you to do type checking on talloc pointers. It is particularly useful for void* private pointers. It is equivalent to this:
497 .sp
498 .RS 4
499 .nf
500 (type *)talloc_check_name(ptr, #type)
501 .fi
502 .RE
503 .SS "talloc_set_type(const void *ptr, type);"
504 .PP
505 This macro allows you to force the name of a pointer to be a particular
506 \fItype\fR. This can be used in conjunction with talloc_get_type() to do type checking on void* pointers.
507 .PP
508 It is equivalent to this:
509 .sp
510 .RS 4
511 .nf
512 talloc_set_name_const(ptr, #type)
513 .fi
514 .RE
515 .SH "PERFORMANCE"
516 .PP
517 All the additional features of talloc(3) over malloc(3) do come at a price. We have a simple performance test in Samba4 that measures talloc() versus malloc() performance, and it seems that talloc() is about 10% slower than malloc() on my x86 Debian Linux box. For Samba, the great reduction in code complexity that we get by using talloc makes this worthwhile, especially as the total overhead of talloc/malloc in Samba is already quite small.
518 .SH "SEE ALSO"
519 .PP
520 malloc(3), strndup(3), vasprintf(3), asprintf(3),
521 \fI\%http://talloc.samba.org/\fR
522 .SH "COPYRIGHT/LICENSE"
523 .PP
524 Copyright (C) Andrew Tridgell 2004
525 .PP
526 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
527 .PP
528 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
529 .PP
530 You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses/.