diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2012-03-09 12:32:31 +1300 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2012-03-09 12:32:31 +1300 |
| commit | f1c3fa97573f7cfda79ae49f628bdc8c2e217be5 (patch) | |
| tree | 98a94423844ea7aa514ef142985abf8f5e5af7c0 /man3/malloc.3 | |
| parent | b084fc293b6d9520403d2be1ecceb78c697e3305 (diff) | |
| download | man-pages-f1c3fa97573f7cfda79ae49f628bdc8c2e217be5.tar.gz | |
malloc.3: NOTES: Add a short discussion of arenas
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man3/malloc.3')
| -rw-r--r-- | man3/malloc.3 | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/man3/malloc.3 b/man3/malloc.3 index afa62c9fb1..2de134d0ef 100644 --- a/man3/malloc.3 +++ b/man3/malloc.3 @@ -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 (), |
