Fix Trond's email address.
[awesomized/libmemcached] / docs / memcached_memory_allocators.pod
1 =head1 NAME
2
3 memcached_set_memory_allocators, memcached_get_memory_allocators - 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
20 void
21 memcached_get_memory_allocators (memcached_st *ptr,
22 memcached_malloc_fn *mem_malloc,
23 memcached_free_fn *mem_free,
24 memcached_realloc_fn *mem_realloc,
25 memcached_calloc_fn *mem_calloc);
26
27 void *
28 (*memcached_malloc_fn) (memcached_st *ptr, const size_t size);
29
30 void *
31 (*memcached_realloc_fn) (memcached_st *ptr, void *mem,
32 const size_t size);
33
34 void
35 (*memcached_free_fn) (memcached_st *ptr, void *mem);
36
37 void *
38 (*memcached_calloc_fn) (memcached_st *ptr, size_t nelem,
39 const size_t elsize);
40
41
42 =head1 DESCRIPTION
43
44 libmemcached(3) allows you to specify your own memory allocators optimized
45 for your application.
46
47 memcached_set_memory_allocators() is used to set the memory allocators used
48 by the memcached instance specified by ptr. Please note that you cannot
49 override only one of the memory allocators, you have to specify a complete
50 new set if you want to override one of them. All of the memory allocation
51 functions should behave as specified in the C99 standard. Specify NULL as
52 all functions to reset them to the default values.
53
54 memcached_get_memory_allocators() is used to get the currently used memory
55 allocators by a mamcached handle.
56
57 The first argument to the memory allocator functions is a pointer to a
58 memcached structure, and you may use the memcached_set_user_data() and
59 memcached_get_user_data() to store a user-specific value to each memcached
60 structure.
61
62 =head1 RETURN
63
64 memcached_set_memory_allocators() return MEMCACHED_SUCCESS upon success,
65 and MEMCACHED_FAILURE if you don't pass a complete set of function pointers.
66
67 =head1 HOME
68
69 To find out more information please check:
70 L<https://launchpad.net/libmemcached>
71
72 =head1 AUTHOR
73
74 Trond Norbye, E<lt>trond.norbye@gmail.comE<gt>
75
76 =head1 SEE ALSO
77
78 memcached(1) libmemcached(3) memcached_get_user_data(3) memcached_set_user_data(3)
79
80 =cut
81