summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libc/stdlib/malloc.353
1 files changed, 28 insertions, 25 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3
index 75b8c69eb7..e0edd9446e 100644
--- a/src/lib/libc/stdlib/malloc.3
+++ b/src/lib/libc/stdlib/malloc.3
@@ -30,9 +30,9 @@
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE. 31.\" SUCH DAMAGE.
32.\" 32.\"
33.\" $OpenBSD: malloc.3,v 1.62 2009/02/13 23:36:17 jmc Exp $ 33.\" $OpenBSD: malloc.3,v 1.63 2009/10/10 18:36:52 otto Exp $
34.\" 34.\"
35.Dd $Mdocdate: February 13 2009 $ 35.Dd $Mdocdate: October 10 2009 $
36.Dt MALLOC 3 36.Dt MALLOC 3
37.Os 37.Os
38.Sh NAME 38.Sh NAME
@@ -425,26 +425,29 @@ The
425function conforms to 425function conforms to
426.St -ansiC . 426.St -ansiC .
427.Sh HISTORY 427.Sh HISTORY
428The present implementation of 428The
429.Fn malloc 429.Nm
430started out as a filesystem on a drum 430family of functions first appeared in
431attached to a 20-bit binary challenged computer built with discrete germanium 431.At v7 .
432transistors, and it has since graduated to handle primary storage rather than 432A new implementation by Chris Kingsley was introduced in
433secondary. 433.Bx 4.2 ,
434.Pp 434followed by a complete rewrite by Poul-Henning Kamp which appeared in
435The main difference from other 435.Fx 2.2
436.Fn malloc 436and was included in
437implementations are believed to be that 437.Ox 2.0 .
438the free pages are not accessed until allocated. 438These implementations were all
439Most 439.Xr sbrk 2
440.Fn malloc 440based.
441implementations will store a data structure containing a, 441In
442possibly double-, linked list in the free chunks of memory, used to tie 442.Ox 3.8 ,
443all the free memory together. 443Thierry Deval rewrote
444That is a quite suboptimal thing to do. 444.Nm
445Every time the free-list is traversed, all the otherwise unused, and very 445to use the
446likely paged out, pages get faulted into primary memory, just to see what 446.Xr mmap 2
447lies after them in the list. 447system call,
448.Pp 448making the page addresses returned by
449On systems which are paging, this can increase the page-faults 449.Nm
450of a process by a factor of five. 450random.
451A rewrite by Otto Moerbeek introducing a new central data stucture and more
452randomization appeared in
453.Ox 4.4 .