1MALLOC_USABLE_SIZE(3) Linux Programmer's Manual MALLOC_USABLE_SIZE(3)
2
3
4
6 malloc_usable_size - obtain size of block of memory allocated from heap
7
9 #include <malloc.h>
10
11 size_t malloc_usable_size (void *ptr);
12
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
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
23 This function is a GNU extension.
24
26 The value returned by malloc_usable_size() may be greater than the
27 requested size of the allocation because of alignment and minimum size
28 constraints. Although the excess bytes can be overwritten by the
29 application without ill effects, this is not good programming practice:
30 the number of excess bytes in an allocation depends on the underlying
31 implementation.
32
33 The main use of this function is for debugging and introspection.
34
36 malloc(3)
37
39 This page is part of release 3.53 of the Linux man-pages project. A
40 description of the project, and information about reporting bugs, can
41 be found at http://www.kernel.org/doc/man-pages/.
42
43
44
45GNU 2012-03-29 MALLOC_USABLE_SIZE(3)