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