Replace pod docs with sphinx docs.
[m6w6/libmemcached] / docs / memcached_memory_allocators.rst
1 .. highlight:: perl
2
3
4 ****
5 NAME
6 ****
7
8
9 memcached_set_memory_allocators, memcached_get_memory_allocators, memcached_set_memory_allocators_context - Manage memory allocator functions
10
11
12 *******
13 LIBRARY
14 *******
15
16
17 C Client Library for memcached (libmemcached, -lmemcached)
18
19
20 ********
21 SYNOPSIS
22 ********
23
24
25
26 .. code-block:: perl
27
28 #include <memcached.h>
29
30 memcached_return_t
31 memcached_set_memory_allocators (memcached_st *ptr,
32 memcached_malloc_fn mem_malloc,
33 memcached_free_fn mem_free,
34 memcached_realloc_fn mem_realloc,
35 memcached_calloc_fn mem_calloc,
36 void *context);
37
38 void
39 memcached_get_memory_allocators (memcached_st *ptr,
40 memcached_malloc_fn *mem_malloc,
41 memcached_free_fn *mem_free,
42 memcached_realloc_fn *mem_realloc,
43 memcached_calloc_fn *mem_calloc);
44
45 void *
46 memcached_get_memory_allocators_context(const memcached_st *ptr);
47
48 void *
49 (*memcached_malloc_fn) (memcached_st *ptr, const size_t size,
50 void *context);
51
52 void *
53 (*memcached_realloc_fn) (memcached_st *ptr, void *mem,
54 const size_t size,
55 void *context);
56
57 void
58 (*memcached_free_fn) (memcached_st *ptr, void *mem,
59 void *context);
60
61 void *
62 (*memcached_calloc_fn) (memcached_st *ptr,
63 size_t nelem,
64 const size_t elsize,
65 void *context);
66
67
68
69 ***********
70 DESCRIPTION
71 ***********
72
73
74 libmemcached(3) allows you to specify your own memory allocators optimized
75 for your application.
76
77 memcached_set_memory_allocators() is used to set the memory allocators used
78 by the memcached instance specified by ptr. Please note that you cannot
79 override only one of the memory allocators, you have to specify a complete
80 new set if you want to override one of them. All of the memory allocation
81 functions should behave as specified in the C99 standard. Specify NULL as
82 all functions to reset them to the default values.
83
84 memcached_get_memory_allocators() is used to get the currently used memory
85 allocators by a mamcached handle.
86
87 memcached_get_memory_allocators_context() returns the void \* that was
88 passed in during the call to memcached_set_memory_allocators().
89
90 The first argument to the memory allocator functions is a pointer to a
91 memcached structure, the is passed as const and you will need to clone
92 it in order to make use of any operation which would modify it.
93
94
95 *****
96 NOTES
97 *****
98
99
100 In version 0.38 all functions were modified to have a context void pointer
101 passed to them. This was so that customer allocators could have their
102 own space for memory.
103
104
105 ******
106 RETURN
107 ******
108
109
110 memcached_set_memory_allocators() return MEMCACHED_SUCCESS upon success,
111 and MEMCACHED_FAILURE if you don't pass a complete set of function pointers.
112
113
114 ****
115 HOME
116 ****
117
118
119 To find out more information please check:
120 `https://launchpad.net/libmemcached <https://launchpad.net/libmemcached>`_
121
122
123 ******
124 AUTHOR
125 ******
126
127
128 Trond Norbye, <trond.norbye@gmail.com>
129 Brian Aker, <brian@tangent.orf<gt>
130
131
132 ********
133 SEE ALSO
134 ********
135
136
137 memcached(1) libmemcached(3) memcached_get_user_data(3) memcached_set_user_data(3)
138