]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/malloc_info.3
strcmp.3: Clarify that strcmp() is not locale aware
[thirdparty/man-pages.git] / man3 / malloc_info.3
index 9f5ae02ec481f942daf44ace77e040ff118c7288..ce344e7cad9c03fcf8bfe8fe1c9a54468c0e68ae 100644 (file)
 .\" the source, must acknowledge the copyright and authors of this work.
 .\" %%%LICENSE_END
 .\"
-.TH MALLOC_INFO 3  2012-04-28 "GNU" "Linux Programmer's Manual"
+.TH MALLOC_INFO 3  2017-09-15 "GNU" "Linux Programmer's Manual"
 .SH NAME
 malloc_info \- export malloc state to a stream
 .SH SYNOPSIS
 .nf
 .B #include <malloc.h>
-.sp
-.BI "int malloc_info(int " options ", FILE *" fp );
+.PP
+.BI "int malloc_info(int " options ", FILE *" stream );
 .fi
 .SH DESCRIPTION
 The
@@ -38,10 +38,10 @@ function exports an XML string that describes the current state
 of the memory-allocation
 implementation in the caller.
 The string is printed on the file stream
-.IR fp .
+.IR stream .
 The exported string includes information about all arenas (see
 .BR malloc (3)).
-
+.PP
 As currently implemented,
 .I options
 must be zero.
@@ -49,7 +49,9 @@ must be zero.
 On success,
 .BR malloc_info ()
 returns 0;
-on error, it returns \-1.
+on error, it returns \-1, with
+.I errno
+set to indicate the cause.
 .SH ERRORS
 .TP
 .B EINVAL
@@ -58,6 +60,19 @@ was nonzero.
 .SH VERSIONS
 .BR malloc_info ()
 was added to glibc in version 2.10.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface      Attribute       Value
+T{
+.BR malloc_info ()
+T}     Thread safety   MT-Safe
+.TE
+.sp 1
 .SH CONFORMING TO
 This function is a GNU extension.
 .SH NOTES
@@ -66,13 +81,13 @@ The memory-allocation information is provided as an XML string
 because the information may change over time
 (according to changes in the underlying implementation).
 The output XML string includes a version field.
-
+.PP
 The
 .BR open_memstream (3)
 function can be used to send the output of
 .BR malloc_info ()
 directly into a buffer in memory, rather than to a file.
-
+.PP
 The
 .BR malloc_info ()
 function is designed to address deficiencies in
@@ -90,14 +105,14 @@ The third argument controls the size of the blocks to be allocated.
 The main thread creates blocks of this size,
 the second thread created by the program allocates blocks of twice this size,
 the third thread allocates blocks of three times this size, and so on.
-
+.PP
 The program calls
 .BR malloc_info ()
 twice to display the memory-allocation state.
 The first call takes place before any threads
 are created or memory allocated.
 The second call is performed after all threads have allocated memory.
-
+.PP
 In the following example,
 the command-line arguments specify the creation of one additional thread,
 and both the main thread and the additional thread
@@ -105,9 +120,9 @@ allocate 10000 blocks of memory.
 After the blocks of memory have been allocated,
 .BR malloc_info ()
 shows the state of two allocation arenas.
+.PP
 .in +4
-.nf
-
+.EX
 .RB "$ " "getconf GNU_LIBC_VERSION"
 glibc 2.13
 .RB "$ " "./a.out 1 10000 100"
@@ -160,11 +175,10 @@ glibc 2.13
 <aspace type="total" size="2113536"/>
 <aspace type="mprotect" size="2113536"/>
 </malloc>
-.fi
+.EE
 .in
 .SS Program source
-.nf
-
+.EX
 #include <unistd.h>
 #include <stdlib.h>
 #include <pthread.h>
@@ -250,7 +264,7 @@ main(int argc, char *argv[])
 
     exit(EXIT_SUCCESS);
 }
-.fi
+.EE
 .SH SEE ALSO
 .BR mallinfo (3),
 .BR malloc (3),