OSDN Git Service

(split) LDP: Update original to LDP v3.65
[linuxjm/LDP_man-pages.git] / original / man3 / mallopt.3
index ddb1aed..751d80c 100644 (file)
@@ -1,6 +1,7 @@
 '\" t
 .\" Copyright (c) 2012 by Michael Kerrisk <mtk.manpages@gmail.com>
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
@@ -20,8 +21,9 @@
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
-.TH MALLOPT 3  2012-04-18 "Linux" "Linux Programmer's Manual"
+.TH MALLOPT 3  2012-04-30 "Linux" "Linux Programmer's Manual"
 .SH NAME
 mallopt \- set memory allocation parameters
 .SH SYNOPSIS
@@ -176,7 +178,7 @@ The initial value of the threshold is 128*1024,
 but when blocks larger than the current threshold and less than or equal to
 .BR DEFAULT_MMAP_THRESHOLD_MAX
 are freed,
-the threshold is adjusted upwards to the size of the freed block.
+the threshold is adjusted upward to the size of the freed block.
 When dynamic mmap thresholding is in effect,
 the threshold for trimming the heap is also dynamically adjusted
 to be twice the dynamic mmap threshold.
@@ -300,7 +302,7 @@ and wasting unused memory at the top of the heap
 .\" These macros aren't enabled in production releases until 2.15?
 .\" (see glibc malloc/Makefile)
 .\"
-.SS Environment Variables
+.SS Environment variables
 A number of environment variables can be defined
 to modify some of the same parameters as are controlled by
 .BR mallopt ().
@@ -309,7 +311,7 @@ of the program need not be changed.
 To be effective, these variables must be defined before the
 first call to a memory-allocation function.
 (If the same parameters are adjusted via
-.BR mallopt ()
+.BR mallopt (),
 then the
 .BR mallopt ()
 settings take precedence.)
@@ -478,6 +480,7 @@ under glibc, with the default value for
 .nf
 
 $ \fB./a.out\fP
+main(): returned from first free() call
 *** glibc detected *** ./a.out: double free or corruption (top): 0x09d30008 ***
 ======= Backtrace: =========
 /lib/libc.so.6(+0x6c501)[0x523501]
@@ -539,17 +542,12 @@ main(int argc, char *argv[])
     char *p;
 
     if (argc > 1) {
-        if (argc != 2) {
-            fprintf(stderr, "%s <M_CHECK_ACTION\-value>\\n", argv[0]);
+        if (mallopt(M_CHECK_ACTION, atoi(argv[1])) != 1) {
+            fprintf(stderr, "mallopt() failed");
             exit(EXIT_FAILURE);
         }
     }
 
-    if (mallopt(M_CHECK_ACTION, atoi(argv[1])) != 1) {
-        fprintf(stderr, "mallopt() failed");
-        exit(EXIT_FAILURE);
-    }
-
     p = malloc(1000);
     if (p == NULL) {
         fprintf(stderr, "malloc() failed");
@@ -568,12 +566,22 @@ main(int argc, char *argv[])
 .SH SEE ALSO
 .ad l
 .nh
-.BR mmap (2)
+.BR mmap (2),
 .BR sbrk (2),
 .BR mallinfo (3),
 .BR malloc (3),
 .BR malloc_hook (3),
+.BR malloc_info (3),
+.BR malloc_stats (3),
 .BR malloc_trim (3),
 .BR mcheck (3),
 .BR mtrace (3),
 .BR posix_memalign (3)
+.SH COLOPHON
+This page is part of release 3.65 of the Linux
+.I man-pages
+project.
+A description of the project,
+and information about reporting bugs,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.