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