'\" 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.
.\"
.\" 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-17 "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
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.
.\" 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 ().
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.)
.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]
.in
.PP
The following runs show the results when employing other values for
-.BR M_CHECK_ACTION:
+.BR M_CHECK_ACTION :
.PP
.in +4n
.nf
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");
.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.68 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.