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