Update docs.
[m6w6/libmemcached] / docs / man / memcached_set_memory_allocators.3
1 .TH "MEMCACHED_SET_MEMORY_ALLOCATORS" "3" "April 08, 2011" "0.47" "libmemcached"
2 .SH NAME
3 memcached_set_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 LIBRARY
36 .sp
37 C Client Library for memcached (libmemcached, \-lmemcached)
38 .SH SYNOPSIS
39 .sp
40 .nf
41 .ft C
42 #include <libmemcached/memcached.h>
43
44 memcached_return_t
45 memcached_set_memory_allocators (memcached_st *ptr,
46 memcached_malloc_fn mem_malloc,
47 memcached_free_fn mem_free,
48 memcached_realloc_fn mem_realloc,
49 memcached_calloc_fn mem_calloc,
50 void *context);
51
52 void
53 memcached_get_memory_allocators (memcached_st *ptr,
54 memcached_malloc_fn *mem_malloc,
55 memcached_free_fn *mem_free,
56 memcached_realloc_fn *mem_realloc,
57 memcached_calloc_fn *mem_calloc);
58
59 void *
60 memcached_get_memory_allocators_context(const memcached_st *ptr);
61
62 void *
63 (*memcached_malloc_fn) (memcached_st *ptr, const size_t size,
64 void *context);
65
66 void *
67 (*memcached_realloc_fn) (memcached_st *ptr, void *mem,
68 const size_t size,
69 void *context);
70
71 void
72 (*memcached_free_fn) (memcached_st *ptr, void *mem,
73 void *context);
74
75 void *
76 (*memcached_calloc_fn) (memcached_st *ptr,
77 size_t nelem,
78 const size_t elsize,
79 void *context);
80 .ft P
81 .fi
82 .SH DESCRIPTION
83 .sp
84 libmemcached(3) allows you to specify your own memory allocators optimized
85 for your application.
86 .sp
87 memcached_set_memory_allocators() is used to set the memory allocators used
88 by the memcached instance specified by ptr. Please note that you cannot
89 override only one of the memory allocators, you have to specify a complete
90 new set if you want to override one of them. All of the memory allocation
91 functions should behave as specified in the C99 standard. Specify NULL as
92 all functions to reset them to the default values.
93 .sp
94 memcached_get_memory_allocators() is used to get the currently used memory
95 allocators by a mamcached handle.
96 .sp
97 memcached_get_memory_allocators_context() returns the void * that was
98 passed in during the call to memcached_set_memory_allocators().
99 .sp
100 The first argument to the memory allocator functions is a pointer to a
101 memcached structure, the is passed as const and you will need to clone
102 it in order to make use of any operation which would modify it.
103 .SH NOTES
104 .sp
105 In version 0.38 all functions were modified to have a context void pointer
106 passed to them. This was so that customer allocators could have their
107 own space for memory.
108 .SH RETURN
109 .sp
110 memcached_set_memory_allocators() return MEMCACHED_SUCCESS upon success,
111 and MEMCACHED_FAILURE if you don\(aqt pass a complete set of function pointers.
112 .SH HOME
113 .sp
114 To find out more information please check:
115 \fI\%https://launchpad.net/libmemcached\fP
116 .SH AUTHOR
117 .sp
118 Trond Norbye, <\fI\%trond.norbye@gmail.com\fP>
119 Brian Aker, <\fI\%brian@tangent\fP.orf<gt>
120 .SH SEE ALSO
121 .sp
122 memcached(1) libmemcached(3) memcached_get_user_data(3) memcached_set_user_data(3)
123 .SH AUTHOR
124 Brian Aker
125 .SH COPYRIGHT
126 2011, Brian Aker
127 .\" Generated by docutils manpage writer.
128 .\"
129 .