diff options
-rw-r--r-- | src/lib/libc/stdlib/malloc.3 | 53 |
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 | |||
425 | function conforms to | 425 | function conforms to |
426 | .St -ansiC . | 426 | .St -ansiC . |
427 | .Sh HISTORY | 427 | .Sh HISTORY |
428 | The present implementation of | 428 | The |
429 | .Fn malloc | 429 | .Nm |
430 | started out as a filesystem on a drum | 430 | family of functions first appeared in |
431 | attached to a 20-bit binary challenged computer built with discrete germanium | 431 | .At v7 . |
432 | transistors, and it has since graduated to handle primary storage rather than | 432 | A new implementation by Chris Kingsley was introduced in |
433 | secondary. | 433 | .Bx 4.2 , |
434 | .Pp | 434 | followed by a complete rewrite by Poul-Henning Kamp which appeared in |
435 | The main difference from other | 435 | .Fx 2.2 |
436 | .Fn malloc | 436 | and was included in |
437 | implementations are believed to be that | 437 | .Ox 2.0 . |
438 | the free pages are not accessed until allocated. | 438 | These implementations were all |
439 | Most | 439 | .Xr sbrk 2 |
440 | .Fn malloc | 440 | based. |
441 | implementations will store a data structure containing a, | 441 | In |
442 | possibly double-, linked list in the free chunks of memory, used to tie | 442 | .Ox 3.8 , |
443 | all the free memory together. | 443 | Thierry Deval rewrote |
444 | That is a quite suboptimal thing to do. | 444 | .Nm |
445 | Every time the free-list is traversed, all the otherwise unused, and very | 445 | to use the |
446 | likely paged out, pages get faulted into primary memory, just to see what | 446 | .Xr mmap 2 |
447 | lies after them in the list. | 447 | system call, |
448 | .Pp | 448 | making the page addresses returned by |
449 | On systems which are paging, this can increase the page-faults | 449 | .Nm |
450 | of a process by a factor of five. | 450 | random. |
451 | A rewrite by Otto Moerbeek introducing a new central data stucture and more | ||
452 | randomization appeared in | ||
453 | .Ox 4.4 . | ||