From 535636b5dfdc9bedba145b34085cc8d2b430c10e Mon Sep 17 00:00:00 2001 From: otto <> Date: Wed, 18 May 2011 18:09:37 +0000 Subject: [PATCH] introduce symbolic constant for initial number of regions --- src/lib/libc/stdlib/malloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 2a1ec5e2..8ab9f355 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.135 2011/05/18 18:07:20 otto Exp $ */ +/* $OpenBSD: malloc.c,v 1.136 2011/05/18 18:09:37 otto Exp $ */ /* * Copyright (c) 2008 Otto Moerbeek * @@ -67,6 +67,7 @@ #define MALLOC_MAXCHUNK (1 << MALLOC_MAXSHIFT) #define MALLOC_MAXCACHE 256 #define MALLOC_DELAYED_CHUNKS 15 /* max of getrnibble() */ +#define MALLOC_INITIAL_REGIONS 512 /* * When the P option is active, we move allocations between half a page * and a whole page towards the end, subject to alignment constraints. @@ -603,7 +604,7 @@ omalloc_init(struct dir_info **dp) d = (struct dir_info *)(p + MALLOC_PAGESIZE + (arc4random_uniform(d_avail) << MALLOC_MINSHIFT)); - d->regions_free = d->regions_total = 512; + d->regions_free = d->regions_total = MALLOC_INITIAL_REGIONS; regioninfo_size = d->regions_total * sizeof(struct region_info); d->r = MMAP(regioninfo_size); if (d->r == MAP_FAILED) {