mirror of https://github.com/mkerrisk/man-pages
malloc.3: NOTES: Add a short discussion of arenas
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
b084fc293b
commit
f1c3fa9757
|
@ -25,7 +25,7 @@
|
|||
.\" 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 2011-09-08 "GNU" "Linux Programmer's Manual"
|
||||
.TH MALLOC 3 2012-03-09 "GNU" "Linux Programmer's Manual"
|
||||
.SH NAME
|
||||
malloc, free, calloc, realloc \- Allocate and free dynamic memory
|
||||
.SH SYNOPSIS
|
||||
|
@ -204,6 +204,24 @@ are unaffected by the
|
|||
resource limit (see
|
||||
.BR getrlimit (2)).
|
||||
|
||||
To avoid corruption in multithreaded applications,
|
||||
mutexes are used internally to protect the memory-management
|
||||
data structures employed by these functions.
|
||||
In a multithreaded application in which threads simultaneously
|
||||
allocate and free memory,
|
||||
there could be contention for these mutexes.
|
||||
To scalably handle memory allocation in multithreaded applications,
|
||||
glibc creates additional
|
||||
.IR "memory allocation arenas"
|
||||
if mutex contention is detected..
|
||||
Each arena is a large region of memory that is internally allocated
|
||||
by the system
|
||||
(using
|
||||
.BR brk (2)
|
||||
or
|
||||
.BR mmap (2)),
|
||||
and managed with its own mutexes.
|
||||
|
||||
The UNIX 98 standard requires
|
||||
.BR malloc (),
|
||||
.BR calloc (),
|
||||
|
|
Loading…
Reference in New Issue