1 .TH "MEMCACHED_MEMORY_ALLOCATORS" "3" "June 02, 2011" "0.47" "libmemcached"
3 memcached_memory_allocators \- libmemcached Documentation
5 .nr rst2man-indent-level 0
9 level \\n[rst2man-indent-level]
10 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
17 .\" .rstReportMargin pre:
19 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
20 . nr rst2man-indent-level +1
21 .\" .rstReportMargin post:
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
31 .\" Man page generated from reStructeredText.
34 Manage memory allocator functions
37 #include <libmemcached/memcached.h>
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);
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);
48 .B void * memcached_get_memory_allocators_context(const memcached_st *ptr);
52 .B void * (*memcached_malloc_fn) (memcached_st *ptr, const size_t size, void *context);
56 .B void * (*memcached_realloc_fn) (memcached_st *ptr, void *mem, const size_t size, void *context);
60 .B void (*memcached_free_fn) (memcached_st *ptr, void *mem, void *context);
64 .B void * (*memcached_calloc_fn) (memcached_st *ptr, size_t nelem, const size_t elsize, void *context);
67 Compile and link with \-lmemcached
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.
73 memcached_set_memory_allocators() is used to set the memory allocators used
74 by the memcached instance specified by ptr. Please note that you cannot
75 override only one of the memory allocators, you have to specify a complete
76 new set if you want to override one of them. All of the memory allocation
77 functions should behave as specified in the C99 standard. Specify NULL as
78 all functions to reset them to the default values.
80 memcached_get_memory_allocators() is used to get the currently used memory
81 allocators by a mamcached handle.
83 memcached_get_memory_allocators_context() returns the void * that was
84 passed in during the call to memcached_set_memory_allocators().
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.
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
96 memcached_set_memory_allocators() return MEMCACHED_SUCCESS upon success,
97 and MEMCACHED_FAILURE if you don\(aqt pass a complete set of function pointers.
100 To find out more information please check:
101 \fI\%http://libmemcached.org/\fP
104 \fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
108 2011, Brian Aker DataDifferential, http://datadifferential.com/
109 .\" Generated by docutils manpage writer.