]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/malloc_info.3
Removed trailing white space at end of lines
[thirdparty/man-pages.git] / man3 / malloc_info.3
index f8a487e41552c75981df6539e574c88540624c80..7953abd5fba49638af473aa2e6e8820361965b62 100644 (file)
 .\" the source, must acknowledge the copyright and authors of this work.
 .\" %%%LICENSE_END
 .\"
-.TH MALLOC_INFO 3  2013-04-19 "GNU" "Linux Programmer's Manual"
+.TH MALLOC_INFO 3  2019-03-06 "GNU" "Linux Programmer's Manual"
 .SH NAME
 malloc_info \- export malloc state to a stream
 .SH SYNOPSIS
 .nf
 .B #include <malloc.h>
-.sp
+.PP
 .BI "int malloc_info(int " options ", FILE *" stream );
 .fi
 .SH DESCRIPTION
@@ -41,7 +41,7 @@ The string is printed on the file stream
 .IR stream .
 The exported string includes information about all arenas (see
 .BR malloc (3)).
-
+.PP
 As currently implemented,
 .I options
 must be zero.
@@ -60,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
@@ -68,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
@@ -92,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
@@ -107,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"
@@ -162,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>
@@ -176,7 +188,7 @@ glibc 2.13
 static size_t blockSize;
 static int numThreads, numBlocks;
 
-#define errExit(msg)    do { perror(msg); exit(EXIT_FAILURE); \\
+#define errExit(msg)    do { perror(msg); exit(EXIT_FAILURE); \e
                         } while (0)
 
 static void *
@@ -204,7 +216,7 @@ main(int argc, char *argv[])
 
     if (argc < 4) {
         fprintf(stderr,
-                "%s num\-threads num\-blocks block\-size [sleep\-time]\\n",
+                "%s num\-threads num\-blocks block\-size [sleep\-time]\en",
                 argv[0]);
         exit(EXIT_FAILURE);
     }
@@ -218,7 +230,7 @@ main(int argc, char *argv[])
     if (thr == NULL)
         errExit("calloc");
 
-    printf("============ Before allocating blocks ============\\n");
+    printf("============ Before allocating blocks ============\en");
     malloc_info(0, stdout);
 
     /* Create threads that allocate different amounts of memory */
@@ -247,12 +259,12 @@ main(int argc, char *argv[])
     sleep(2);           /* Give all threads a chance to
                            complete allocations */
 
-    printf("\\n============ After allocating blocks ============\\n");
+    printf("\en============ After allocating blocks ============\en");
     malloc_info(0, stdout);
 
     exit(EXIT_SUCCESS);
 }
-.fi
+.EE
 .SH SEE ALSO
 .BR mallinfo (3),
 .BR malloc (3),