Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

malloc_usable_size(3) [v7 man page]

MALLOC_USABLE_SIZE(3)					     Linux Programmer's Manual					     MALLOC_USABLE_SIZE(3)

NAME
malloc_usable_size - obtain size of block of memory allocated from heap SYNOPSIS
#include <malloc.h> size_t malloc_usable_size (void *ptr); DESCRIPTION
The malloc_usable_size() function returns the number of usable bytes in the block pointed to by ptr, a pointer to a block of memory allo- cated by malloc(3) or a related function. RETURN VALUE
malloc_usable_size() returns the number of usable bytes in the block of allocated memory pointed to by ptr. If ptr is NULL, 0 is returned. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +---------------------+---------------+---------+ |Interface | Attribute | Value | +---------------------+---------------+---------+ |malloc_usable_size() | Thread safety | MT-Safe | +---------------------+---------------+---------+ CONFORMING TO
This function is a GNU extension. NOTES
The value returned by malloc_usable_size() may be greater than the requested size of the allocation because of alignment and minimum size constraints. Although the excess bytes can be overwritten by the application without ill effects, this is not good programming practice: the number of excess bytes in an allocation depends on the underlying implementation. The main use of this function is for debugging and introspection. SEE ALSO
malloc(3) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2017-09-15 MALLOC_USABLE_SIZE(3)

Check Out this Related Man Page

MALLOC_USABLE_SIZE(3)					     Linux Programmer's Manual					     MALLOC_USABLE_SIZE(3)

NAME
malloc_usable_size - obtain size of block of memory allocated from heap SYNOPSIS
#include <malloc.h> size_t malloc_usable_size (void *ptr); DESCRIPTION
The malloc_usable_size() function returns the number of usable bytes in the block pointed to by ptr, a pointer to a block of memory allo- cated by malloc(3) or a related function. RETURN VALUE
malloc_usable_size() returns the number of usable bytes in the block of allocated memory pointed to by ptr. If ptr is NULL, 0 is returned. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +---------------------+---------------+---------+ |Interface | Attribute | Value | +---------------------+---------------+---------+ |malloc_usable_size() | Thread safety | MT-Safe | +---------------------+---------------+---------+ CONFORMING TO
This function is a GNU extension. NOTES
The value returned by malloc_usable_size() may be greater than the requested size of the allocation because of alignment and minimum size constraints. Although the excess bytes can be overwritten by the application without ill effects, this is not good programming practice: the number of excess bytes in an allocation depends on the underlying implementation. The main use of this function is for debugging and introspection. SEE ALSO
malloc(3) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2017-09-15 MALLOC_USABLE_SIZE(3)
Man Page

5 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to get more experience???

Hi everybody, I'm kinda fed up with all the theoritical part of programming. I wonder if there is any online project or something where i can participate to practice my skills? Any other suggestions how to build up practical side of Unix C programming? Thank you all. (1 Reply)
Discussion started by: solvman
1 Replies

2. Programming

file ptr.

Is there any way to know the filename from an available file pointer. (2 Replies)
Discussion started by: bankpro
2 Replies

3. Programming

question regarding multithreading and malloc() requests

Is it generally not a good idea in a multithreaded program to make lots of malloc calls (dynamic memory requests) because of the limited nature of the memory heap ? Out of curiosity (warning it may sound silly), but would using mutexs (mutual exclusion) help to minimise chances of runtime errors... (12 Replies)
Discussion started by: JamesGoh
12 Replies

4. Fedora

How is OS X related to unix

Ok, I gotta ask this question, I have just begun fundamentals of UNIX in college and have learned or heard that Mac's OS-X is a linux based os! Does this mean that unix shell commands work in OS-X? I have no experience with os-x yet. I know it's a stupid question but I gotta know! (10 Replies)
Discussion started by: boarder428
10 Replies

5. Programming

memory allocation in subroutine

Hi everyone, I'm not new to C programming, but I'm having question regarding the memory allocation of a pointer variable which, for instance, will be declared in main(), but its memory will be allocated in subroutine. To clearify my question, I provide a small working example: #include... (1 Reply)
Discussion started by: MIB_Maik
1 Replies