1MALLOC_USABLE_SIZE(3)      Linux Programmer's Manual     MALLOC_USABLE_SIZE(3)
2
3
4

NAME

6       malloc_usable_size - obtain size of block of memory allocated from heap
7

SYNOPSIS

9       #include <malloc.h>
10
11       size_t malloc_usable_size (void *ptr);
12

DESCRIPTION

14       The malloc_usable_size() function returns the number of usable bytes in
15       the block pointed to by ptr, a pointer to a block of  memory  allocated
16       by malloc(3) or a related function.
17

RETURN VALUE

19       malloc_usable_size() returns the number of usable bytes in the block of
20       allocated memory pointed to by ptr.  If ptr is NULL, 0 is returned.
21

ATTRIBUTES

23       For  an  explanation  of  the  terms  used   in   this   section,   see
24       attributes(7).
25
26       ┌─────────────────────┬───────────────┬─────────┐
27Interface            Attribute     Value   
28       ├─────────────────────┼───────────────┼─────────┤
29malloc_usable_size() │ Thread safety │ MT-Safe │
30       └─────────────────────┴───────────────┴─────────┘

CONFORMING TO

32       This function is a GNU extension.
33

NOTES

35       The  value  returned  by  malloc_usable_size()  may be greater than the
36       requested size of the allocation because of alignment and minimum  size
37       constraints.   Although  the  excess  bytes  can  be overwritten by the
38       application without ill effects, this is not good programming practice:
39       the  number  of excess bytes in an allocation depends on the underlying
40       implementation.
41
42       The main use of this function is for debugging and introspection.
43

SEE ALSO

45       malloc(3)
46

COLOPHON

48       This page is part of release 5.07 of the Linux  man-pages  project.   A
49       description  of  the project, information about reporting bugs, and the
50       latest    version    of    this    page,    can     be     found     at
51       https://www.kernel.org/doc/man-pages/.
52
53
54
55GNU                               2017-09-15             MALLOC_USABLE_SIZE(3)
Impressum