1explain_malloc_or_die(3) Library Functions Manual explain_malloc_or_die(3)
2
3
4
6 explain_malloc_or_die - Allocate and free dynamic memory and report
7 errors
8
10 #include <libexplain/malloc.h>
11 void *explain_malloc_or_die(size_t size);
12
14 The explain_malloc_or_die function is used to call the malloc(3) system
15 call. On failure an explanation will be printed to stderr, obtained
16 from explain_malloc(3), and then the process terminates by calling
17 exit(EXIT_FAILURE).
18
19 This function is intended to be used in a fashion similar to the fol‐
20 lowing example:
21 void *result = explain_malloc_or_die(size);
22
23 size The size, exactly as to be passed to the malloc(3) system call.
24
25 Returns:
26 This function only returns on success. On failure, prints an
27 explanation and exits.
28
30 malloc(3)
31 Allocate and free dynamic memory
32
33 explain_malloc(3)
34 explain malloc(3) errors
35
36 exit(2) terminate the calling process
37
39 libexplain version 1.4
40 Copyright (C) 2009 Peter Miller
41
42
43
44 explain_malloc_or_die(3)