1MEMCACHED_GET_MEMORY_ALLOCATORS(3)libmemcachedMEMCACHED_GET_MEMORY_ALLOCATORS(3)
2
3
4
6 memcached_get_memory_allocators - libmemcached Documentation
7
8 Manage memory allocator functions
9
11 #include <libmemcached/memcached.h>
12
13 memcached_return_t memcached_set_memory_allocators(memcached_st *ptr,
14 memcached_malloc_fn mem_malloc, memcached_free_fn mem_free,
15 memcached_realloc_fn mem_realloc, memcached_calloc_fn mem_calloc,
16 void *context)
17
18 void memcached_get_memory_allocators(memcached_st *ptr,
19 memcached_malloc_fn *mem_malloc, memcached_free_fn *mem_free,
20 memcached_realloc_fn *mem_realloc, memcached_calloc_fn *mem_calloc)
21
22 void * memcached_get_memory_allocators_context(const memcached_st *ptr)
23
24 void * (*memcached_malloc_fn)(memcached_st *ptr, const size_t size,
25 void *context)
26
27 void * (*memcached_realloc_fn)(memcached_st *ptr, void *mem, const
28 size_t size, void *context)
29
30 void (*memcached_free_fn)(memcached_st *ptr, void *mem, void *context)
31
32 void * (*memcached_calloc_fn)(memcached_st *ptr, size_t nelem, const
33 size_t elsize, void *context)
34
35 Compile and link with -lmemcached
36
38 libmemcached(3) allows you to specify your own memory allocators, opti‐
39 mized for your application. This enables libmemcached to be used inside
40 of applications that have their own malloc implementation.
41
42 memcached_set_memory_allocators() is used to set the memory allocators
43 used by the memcached instance specified by ptr. Please note that you
44 cannot override only one of the memory allocators, you have to specify
45 a complete new set if you want to override one of them. All of the mem‐
46 ory allocation functions should behave as specified in the C99 stan‐
47 dard. Specify NULL as all functions to reset them to the default val‐
48 ues.
49
50 memcached_get_memory_allocators() is used to get the currently used
51 memory allocators by a mamcached handle.
52
53 memcached_get_memory_allocators_context() returns the void * that was
54 passed in during the call to memcached_set_memory_allocators().
55
56 The first argument to the memory allocator functions is a pointer to a
57 memcached structure, the is passed as const and you will need to clone
58 it in order to make use of any operation which would modify it.
59
61 In version 0.38 all functions were modified to have a context void
62 pointer passed to them. This was so that customer allocators could have
63 their own space for memory.
64
66 memcached_set_memory_allocators() return MEMCACHED_SUCCESS upon suc‐
67 cess, and MEMCACHED_FAILURE if you don't pass a complete set of func‐
68 tion pointers.
69
71 To find out more information please check: http://libmemcached.org/
72
74 memcached(1) libmemcached(3) memcached_strerror(3)
75
77 Brian Aker
78
80 2011-2013, Brian Aker DataDifferential, http://datadifferential.com/
81
82
83
84
851.0.18 February 09, 2M0E1M4CACHED_GET_MEMORY_ALLOCATORS(3)