Sun Jul 26 17:09:29 2015 UTC ()
Add history of allocators

Idea accepted by <christos>
No objctions from <riastradh>


(kamil)
diff -r1.42 -r1.43 src/lib/libc/stdlib/malloc.3

cvs diff -r1.42 -r1.43 src/lib/libc/stdlib/malloc.3 (expand / switch to unified diff)

--- src/lib/libc/stdlib/malloc.3 2015/07/26 17:00:37 1.42
+++ src/lib/libc/stdlib/malloc.3 2015/07/26 17:09:29 1.43
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: malloc.3,v 1.42 2015/07/26 17:00:37 kamil Exp $ 1.\" $NetBSD: malloc.3,v 1.43 2015/07/26 17:09:29 kamil Exp $
2.\" 2.\"
3.\" Copyright (c) 1980, 1991, 1993 3.\" Copyright (c) 1980, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to Berkeley by 6.\" This code is derived from software contributed to Berkeley by
7.\" the American National Standards Committee X3, on Information 7.\" the American National Standards Committee X3, on Information
8.\" Processing Systems. 8.\" Processing Systems.
9.\" 9.\"
10.\" Redistribution and use in source and binary forms, with or without 10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions 11.\" modification, are permitted provided that the following conditions
12.\" are met: 12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright 13.\" 1. Redistributions of source code must retain the above copyright
14.\" notice, this list of conditions and the following disclaimer. 14.\" notice, this list of conditions and the following disclaimer.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE. 32.\" SUCH DAMAGE.
33.\" 33.\"
34.\" @(#)malloc.3 8.1 (Berkeley) 6/4/93 34.\" @(#)malloc.3 8.1 (Berkeley) 6/4/93
35.\" $FreeBSD: src/lib/libc/stdlib/malloc.3,v 1.73 2007/06/15 22:32:33 jasone Exp $ 35.\" $FreeBSD: src/lib/libc/stdlib/malloc.3,v 1.73 2007/06/15 22:32:33 jasone Exp $
36.\" 36.\"
37.Dd February 5, 2015 37.Dd July 26, 2015
38.Dt MALLOC 3 38.Dt MALLOC 3
39.Os 39.Os
40.Sh NAME 40.Sh NAME
41.Nm malloc , calloc , realloc , free 41.Nm malloc , calloc , realloc , free
42.Nd general purpose memory allocation functions 42.Nd general purpose memory allocation functions
43.Sh LIBRARY 43.Sh LIBRARY
44.Lb libc 44.Lb libc
45.Sh SYNOPSIS 45.Sh SYNOPSIS
46.In stdlib.h 46.In stdlib.h
47.Ft void * 47.Ft void *
48.Fn malloc "size_t size" 48.Fn malloc "size_t size"
49.Ft void * 49.Ft void *
50.Fn calloc "size_t number" "size_t size" 50.Fn calloc "size_t number" "size_t size"
@@ -255,13 +255,57 @@ size = newsize; @@ -255,13 +255,57 @@ size = newsize;
255.Xr reallocarr 3 255.Xr reallocarr 3
256.Pp 256.Pp
257For the implementation details, see 257For the implementation details, see
258.Xr jemalloc 3 . 258.Xr jemalloc 3 .
259.Sh STANDARDS 259.Sh STANDARDS
260The 260The
261.Fn malloc , 261.Fn malloc ,
262.Fn calloc , 262.Fn calloc ,
263.Fn realloc 263.Fn realloc
264and 264and
265.Fn free 265.Fn free
266functions conform to 266functions conform to
267.St -isoC . 267.St -isoC .
 268.Sh HISTORY
 269A
 270.Fn free
 271internal kernel function and a predecessor to
 272.Fn malloc ,
 273.Fn alloc ,
 274first appeared in
 275.At v1 .
 276The C Library functions
 277.Fn alloc
 278and
 279.Fn free
 280appeared in
 281.At v6 .
 282The functions
 283.Fn malloc ,
 284.Fn calloc ,
 285and
 286.Fn realloc
 287first appeared in
 288.At v7 .
 289.Pp
 290A new implementation by Chris Kingsley was introduced in
 291.Bx 4.2 ,
 292followed by a complete rewrite by Poul-Henning Kamp (
 293.Dq phk's malloc
 294or
 295.Dq new malloc )
 296which appeared in
 297.Fx 2.2
 298and was included in
 299.Nx 1.5
 300and
 301.Ox 2.0 .
 302These implementations were all
 303.Xr sbrk 2
 304based.
 305.Pp
 306The
 307.Fn jemalloc 3
 308allocator became the default system allocator first in
 309.Fx 7.0
 310and then in
 311.Nx 5.0 .