]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/malloc.3
malloc.3: NOTES: Add a short discussion of arenas
[thirdparty/man-pages.git] / man3 / malloc.3
index afa62c9fb17fdcc3b0ccd0af3551af31389306c1..2de134d0efffa89963ad5d413e15e0b65b64ba00 100644 (file)
@@ -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 (),