1malloc_usable_size(3)      Library Functions Manual      malloc_usable_size(3)
2
3
4

NAME

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

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <malloc.h>
13
14       size_t malloc_usable_size(void *_Nullable ptr);
15

DESCRIPTION

17       This  function  can be used for diagnostics or statistics about alloca‐
18       tions from malloc(3) or a related function.
19

RETURN VALUE

21       malloc_usable_size() returns a value no less than the size of the block
22       of allocated memory pointed to by ptr.  If ptr is NULL, 0 is returned.
23

ATTRIBUTES

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

STANDARDS

35       GNU.
36

CAVEATS

38       The value returned by malloc_usable_size()  may  be  greater  than  the
39       requested   size   of   the  allocation  because  of  various  internal
40       implementation details, none of which the programmer  should  rely  on.
41       This  function  is  intended  to  only  be  used  for  diagnostics  and
42       statistics;  writing  to  the  excess  memory  without  first   calling
43       realloc(3)  to  resize  the  allocation is not supported.  The returned
44       value is only valid at the time of the call.
45

SEE ALSO

47       malloc(3)
48
49
50
51Linux man-pages 6.05              2023-07-20             malloc_usable_size(3)
Impressum