diff options
author | otto <> | 2011-05-18 18:09:37 +0000 |
---|---|---|
committer | otto <> | 2011-05-18 18:09:37 +0000 |
commit | 2d4345005b94282c06777d8e695bb547ed15d577 (patch) | |
tree | 582624f6dff43a0ee1db9d60e45c3106f85cbf6e /src | |
parent | b97cdc2e94b7b8949f7db50f8437fe790dcd1a41 (diff) | |
download | openbsd-2d4345005b94282c06777d8e695bb547ed15d577.tar.gz openbsd-2d4345005b94282c06777d8e695bb547ed15d577.tar.bz2 openbsd-2d4345005b94282c06777d8e695bb547ed15d577.zip |
introduce symbolic constant for initial number of regions
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 2a1ec5e21e..8ab9f355e9 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: malloc.c,v 1.135 2011/05/18 18:07:20 otto Exp $ */ | 1 | /* $OpenBSD: malloc.c,v 1.136 2011/05/18 18:09:37 otto Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> | 3 | * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> |
4 | * | 4 | * |
@@ -67,6 +67,7 @@ | |||
67 | #define MALLOC_MAXCHUNK (1 << MALLOC_MAXSHIFT) | 67 | #define MALLOC_MAXCHUNK (1 << MALLOC_MAXSHIFT) |
68 | #define MALLOC_MAXCACHE 256 | 68 | #define MALLOC_MAXCACHE 256 |
69 | #define MALLOC_DELAYED_CHUNKS 15 /* max of getrnibble() */ | 69 | #define MALLOC_DELAYED_CHUNKS 15 /* max of getrnibble() */ |
70 | #define MALLOC_INITIAL_REGIONS 512 | ||
70 | /* | 71 | /* |
71 | * When the P option is active, we move allocations between half a page | 72 | * When the P option is active, we move allocations between half a page |
72 | * and a whole page towards the end, subject to alignment constraints. | 73 | * and a whole page towards the end, subject to alignment constraints. |
@@ -603,7 +604,7 @@ omalloc_init(struct dir_info **dp) | |||
603 | d = (struct dir_info *)(p + MALLOC_PAGESIZE + | 604 | d = (struct dir_info *)(p + MALLOC_PAGESIZE + |
604 | (arc4random_uniform(d_avail) << MALLOC_MINSHIFT)); | 605 | (arc4random_uniform(d_avail) << MALLOC_MINSHIFT)); |
605 | 606 | ||
606 | d->regions_free = d->regions_total = 512; | 607 | d->regions_free = d->regions_total = MALLOC_INITIAL_REGIONS; |
607 | regioninfo_size = d->regions_total * sizeof(struct region_info); | 608 | regioninfo_size = d->regions_total * sizeof(struct region_info); |
608 | d->r = MMAP(regioninfo_size); | 609 | d->r = MMAP(regioninfo_size); |
609 | if (d->r == MAP_FAILED) { | 610 | if (d->r == MAP_FAILED) { |