aboutsummaryrefslogtreecommitdiffstats
path: root/man3/malloc.3
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2007-09-10 03:49:52 +0000
committerMichael Kerrisk <mtk.manpages@gmail.com>2007-09-10 03:49:52 +0000
commit005d4448764fc8463ce01ad28d648c2a20398fbf (patch)
tree65d78bd1f7f94fc033beff5a166be333f47e651d /man3/malloc.3
parentaf9c7ff296d820ef13b6e62a53ec2e9aeb5aaead (diff)
downloadman-pages-005d4448764fc8463ce01ad28d648c2a20398fbf.tar.gz
Added notes on malloc()'s use of sbrk() and mmap().
Diffstat (limited to 'man3/malloc.3')
-rw-r--r--man3/malloc.327
1 files changed, 26 insertions, 1 deletions
diff --git a/man3/malloc.3 b/man3/malloc.3
index c496f1714f..7bc74a3e56 100644
--- a/man3/malloc.3
+++ b/man3/malloc.3
@@ -23,8 +23,9 @@
.\" Modified Sat Jul 24 19:00:59 1993 by Rik Faith (faith@cs.unc.edu)
.\" Clarification concerning realloc, iwj10@cus.cam.ac.uk (Ian Jackson), 950701
.\" Documented MALLOC_CHECK_, Wolfram Gloger (wmglo@dent.med.uni-muenchen.de)
+.\" 2007-09-15 mtk: added notes on malloc()'s use of sbrk() and mmap().
.\"
-.TH MALLOC 3 2007-07-25 "GNU" "Linux Programmer's Manual"
+.TH MALLOC 3 2007-09-15 "GNU" "Linux Programmer's Manual"
.SH NAME
calloc, malloc, free, realloc \- Allocate and free dynamic memory
.SH SYNOPSIS
@@ -141,6 +142,28 @@ fails the original block is left untouched; it is not freed or moved.
.SH "CONFORMING TO"
C89, C99.
.SH NOTES
+Normally,
+.BR malloc ()
+allocates memory from the heap, and adjusts the size of the heap
+as required, using
+.BR sbrk (2).
+When allocating blocks of memory larger than
+.B MMAP_THRESHOLD
+bytes, the glibc
+.BR malloc ()
+implementation allocates the memory as a private anonymous mapping using
+.BR mmap (2).
+.B MMAP_THRESHOLD
+is 128 kB by default, but is adjustable using
+.BR mallopt (3).
+.\" FIXME -- there is no mallopt(3) man page yet.
+Allocations performed using
+.BR mmap (2)
+are unaffected by the
+.B RLIMIT_DATA
+resource limit (see
+.BR getrlimit (2)).
+
The Unix98 standard requires
.BR malloc (),
.BR calloc (),
@@ -222,5 +245,7 @@ and
.IR sysctl/vm.txt .
.SH "SEE ALSO"
.BR brk (2),
+.\" .BR mallopt (3),
+.BR mmap (2),
.BR alloca (3),
.BR posix_memalign (3)