X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fmemcached_memory_allocators.html;h=870f0f0aa63b8666607a656b6d83c16bcad6bcef;hb=ec0598837ed468aa8e633d5b6a08e12f8614a8d2;hp=c7dd14a7d89ddf13bdae08ff230aad8c5f70993e;hpb=d517b40976d8e986cada6b8b896e8f12cd179fa6;p=awesomized%2Flibmemcached diff --git a/libmemcached/memcached_memory_allocators.html b/libmemcached/memcached_memory_allocators.html index c7dd14a7..870f0f0a 100644 --- a/libmemcached/memcached_memory_allocators.html +++ b/libmemcached/memcached_memory_allocators.html @@ -8,7 +8,7 @@ - Use custom allocators for embedded usage — libmemcached 1.0.99 documentation + Use custom allocators for embedded usage — libmemcached 1.1.0 documentation @@ -21,10 +21,10 @@ - - - - + + + + @@ -36,7 +36,7 @@ - + @@ -61,7 +61,7 @@
- 1.0 + 1.1
@@ -85,8 +85,7 @@ -

libmemcached

- -

libmemcachedutil

- -

libhashkit

- -

Client Applications

- -

Copyright

@@ -185,6 +173,10 @@
  • + + Edit on GitHub + +
  • @@ -201,44 +193,151 @@

    Manage memory allocator functions

    SYNOPSIS¶

    -
    -
    #include <libmemcached/memcached.h>

    Compile and link with -lmemcached

    -
    +
    +
    #include <libmemcached/memcached.h>
    +
    Compile and link with -lmemcached
    -
    +
    -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)¶
    -
    - -
    +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)¶
    +
    +++ + + + + + +
    Parameters: +
    Returns:

    memcached_return_t indicating success

    +
    +
    + +
    -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)¶
    -
    +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)¶
    +
    +++ + + + +
    Parameters: +
    +
    -
    +
    -void *memcached_get_memory_allocators_context(const memcached_st *ptr)¶
    -
    - -
    +void *memcached_get_memory_allocators_context(const memcached_st *ptr)¶
    +
    +++ + + + + + +
    Parameters:ptr -- pointer to an initialized memcached_st struct
    Returns:pointer to the user supplied context
    +
    + +
    -typedef void *(*memcached_malloc_fn)(memcached_st *ptr, const size_t size, void *context)¶
    -
    - -
    +typedef void *(*memcached_malloc_fn)(memcached_st *ptr, const size_t size, void *context)¶
    +
    +++ + + + + + +
    Parameters:
      +
    • ptr -- pointer to an initialized memcached_st struct
    • +
    • size -- the number of bytes to allocate
    • +
    • context -- pointer to the user supplied context
    • +
    +
    Returns:

    pointer to at least size bytes of allocated memory

    +
    +
    + +
    -typedef void *(*memcached_realloc_fn)(memcached_st *ptr, void *mem, const size_t size, void *context)¶
    -
    - -
    +typedef void *(*memcached_realloc_fn)(memcached_st *ptr, void *mem, const size_t size, void *context)¶
    +
    +++ + + + + + +
    Parameters:
      +
    • ptr -- pointer to an initialized memcached_st struct
    • +
    • mem -- pointer to previously allocated memory
    • +
    • size -- the number of bytes to allocate
    • +
    • context -- pointer to the user supplied context
    • +
    +
    Returns:

    pointer to at least size bytes of allocated memory

    +
    +
    + +
    -typedef void (*memcached_free_fn)(memcached_st *ptr, void *mem, void *context)¶
    -
    +typedef void (*memcached_free_fn)(memcached_st *ptr, void *mem, void *context)¶
    +
    +++ + + + +
    Parameters:
      +
    • ptr -- pointer to an initialized memcached_st struct
    • +
    • mem -- pointer to previously allocated memory
    • +
    • context -- pointer to the user supplied context
    • +
    +
    +
    -
    +
    -typedef void *(*memcached_calloc_fn)(memcached_st *ptr, size_t nelem, const size_t elsize, void *context)¶
    -
    +typedef void *(*memcached_calloc_fn)(memcached_st *ptr, size_t nelem, const size_t elsize, void *context)¶
    +
    +++ + + + + + +
    Parameters:
      +
    • ptr -- pointer to an initialized memcached_st struct
    • +
    • nelem -- number of elements to allocate
    • +
    • elsize -- the number of bytes to allocate per element
    • +
    • context -- pointer to the user supplied context
    • +
    +
    Returns:

    pointer to at least elsize * nelem bytes of allocated and zeroed memory

    +
    +
    @@ -263,20 +362,20 @@ use of any operation which would modify it.

    NOTES¶

    In version 0.38 all functions were modified to have a context void pointer -passed to them. This was so that customer allocators could have their own space +passed to them. This was so that custom allocators could have their own space for memory.

    RETURN VALUE¶

    -

    memcached_set_memory_allocators() return MEMCACHED_SUCCESS upon success, +

    memcached_set_memory_allocators() returns MEMCACHED_SUCCESS upon success, and MEMCACHED_FAILURE if you don't pass a complete set of function pointers.

    SEE ALSO¶

    @@ -289,7 +388,7 @@ and - +