1NE_MALLOC(3) neon API reference NE_MALLOC(3)
2
3
4
6 ne_malloc, ne_calloc, ne_realloc, ne_strdup, ne_strndup,
7 ne_oom_callback - memory allocation wrappers
8
10 #include <ne_alloc.h>
11
12 void *ne_malloc(size_t size);
13
14 void *ne_calloc(size_t size);
15
16 void *ne_realloc(void *size, size_t len);
17
18 char *ne_strdup(const char *s);
19
20 char *ne_strndup(const char *s, size_t size);
21
22 void ne_oom_callback(void (*callback)(void));
23
25 The functions ne_malloc, ne_calloc, ne_realloc, ne_strdup and
26 ne_strdnup provide wrappers for the equivalent functions in the
27 standard C library. The wrappers provide the extra guarantee that if
28 the C library equivalent returns NULL when no memory is available, an
29 optional callback will be called, and the library will then call
30 abort().
31
32 ne_oom_callback registers a callback which will be invoked if an out of
33 memory error is detected.
34
36 If the operating system uses optimistic memory allocation, the C
37 library memory allocation routines will not return NULL, so it is not
38 possible to gracefully handle memory allocation failures.
39
41 Joe Orton <neon@lists.manyfish.co.uk>
42 Author.
43
45neon 0.29.3 11 January 2010 NE_MALLOC(3)