Merge from tip
[awesomized/libmemcached] / docs / man / memcached_memory_allocators.3
1 .TH "MEMCACHED_MEMORY_ALLOCATORS" "3" "October 24, 2011" "1.01" "libmemcached"
2 .SH NAME
3 memcached_memory_allocators \- libmemcached Documentation
4 .
5 .nr rst2man-indent-level 0
6 .
7 .de1 rstReportMargin
8 \\$1 \\n[an-margin]
9 level \\n[rst2man-indent-level]
10 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
11 -
12 \\n[rst2man-indent0]
13 \\n[rst2man-indent1]
14 \\n[rst2man-indent2]
15 ..
16 .de1 INDENT
17 .\" .rstReportMargin pre:
18 . RS \\$1
19 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
20 . nr rst2man-indent-level +1
21 .\" .rstReportMargin post:
22 ..
23 .de UNINDENT
24 . RE
25 .\" indent \\n[an-margin]
26 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
27 .nr rst2man-indent-level -1
28 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
29 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
30 ..
31 .\" Man page generated from reStructeredText.
32 .
33 .sp
34 Manage memory allocator functions
35 .SH SYNOPSIS
36 .sp
37 #include <libmemcached/memcached.h>
38 .INDENT 0.0
39 .TP
40 .B memcached_return_t memcached_set_memory_allocators (memcached_st *ptr, memcached_malloc_fn mem_malloc, memcached_free_fn mem_free, memcached_realloc_fn mem_realloc, memcached_calloc_fn mem_calloc, void *context);
41 .UNINDENT
42 .INDENT 0.0
43 .TP
44 .B void memcached_get_memory_allocators (memcached_st *ptr, memcached_malloc_fn *mem_malloc, memcached_free_fn *mem_free, memcached_realloc_fn *mem_realloc, memcached_calloc_fn *mem_calloc);
45 .UNINDENT
46 .INDENT 0.0
47 .TP
48 .B void * memcached_get_memory_allocators_context(const memcached_st *ptr);
49 .UNINDENT
50 .INDENT 0.0
51 .TP
52 .B void * (*memcached_malloc_fn) (memcached_st *ptr, const size_t size, void *context);
53 .UNINDENT
54 .INDENT 0.0
55 .TP
56 .B void * (*memcached_realloc_fn) (memcached_st *ptr, void *mem, const size_t size, void *context);
57 .UNINDENT
58 .INDENT 0.0
59 .TP
60 .B void (*memcached_free_fn) (memcached_st *ptr, void *mem, void *context);
61 .UNINDENT
62 .INDENT 0.0
63 .TP
64 .B void * (*memcached_calloc_fn) (memcached_st *ptr, size_t nelem, const size_t elsize, void *context);
65 .UNINDENT
66 .sp
67 Compile and link with \-lmemcached
68 .SH DESCRIPTION
69 .sp
70 libmemcached(3) allows you to specify your own memory allocators, optimized
71 for your application. This enables libmemcached to be used inside of applications that have their own malloc implementation.
72 .sp
73 \fBmemcached_set_memory_allocators()\fP is used to set the memory
74 allocators used by the memcached instance specified by ptr. Please note that
75 you cannot override only one of the memory allocators, you have to specify a
76 complete new set if you want to override one of them. All of the memory
77 allocation functions should behave as specified in the C99 standard. Specify
78 NULL as all functions to reset them to the default values.
79 .sp
80 \fBmemcached_get_memory_allocators()\fP is used to get the currently used
81 memory allocators by a mamcached handle.
82 .sp
83 \fBmemcached_get_memory_allocators_context()\fP returns the void * that
84 was passed in during the call to \fBmemcached_set_memory_allocators()\fP.
85 .sp
86 The first argument to the memory allocator functions is a pointer to a
87 memcached structure, the is passed as const and you will need to clone
88 it in order to make use of any operation which would modify it.
89 .SH NOTES
90 .sp
91 In version 0.38 all functions were modified to have a context void pointer
92 passed to them. This was so that customer allocators could have their
93 own space for memory.
94 .SH RETURN
95 .sp
96 \fBmemcached_set_memory_allocators()\fP return \fBMEMCACHED_SUCCESS\fP
97 upon success, and \fBMEMCACHED_FAILURE\fP if you don\(aqt pass a complete set
98 of function pointers.
99 .SH HOME
100 .sp
101 To find out more information please check:
102 \fI\%http://libmemcached.org/\fP
103 .SH SEE ALSO
104 .sp
105 \fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
106 .SH AUTHOR
107 Brian Aker
108 .SH COPYRIGHT
109 2011, Brian Aker DataDifferential, http://datadifferential.com/
110 .\" Generated by docutils manpage writer.
111 .\"
112 .