diff options
author | Jason Evans <jasone@FreeBSD.org> | 2008-11-03 21:17:18 +0000 |
---|---|---|
committer | Jason Evans <jasone@FreeBSD.org> | 2008-11-03 21:17:18 +0000 |
commit | b74d3e0c371a55cbd7aba7dc2c9f0001783aa231 (patch) | |
tree | 3003ac9eb634a37623e6d93b4ab3f2d2d6cc424c /lib | |
parent | 4482f952b11ef6c4a7870b793971201d7c1c4638 (diff) |
Notes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/stdlib/malloc.3 | 2 | ||||
-rw-r--r-- | lib/libc/stdlib/malloc.c | 29 |
2 files changed, 18 insertions, 13 deletions
diff --git a/lib/libc/stdlib/malloc.3 b/lib/libc/stdlib/malloc.3 index 994038da0b127..a621a245b4063 100644 --- a/lib/libc/stdlib/malloc.3 +++ b/lib/libc/stdlib/malloc.3 @@ -255,7 +255,7 @@ If both the .Dq D and .Dq M -options are enabled, the allocator prefers the DSS over anonymous mappings, +options are enabled, the allocator prefers anonymous mappings over the DSS, but allocation only fails if memory cannot be acquired via either method. If neither option is enabled, then the .Dq M diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 00b169fa12b3b..55bc4133a324d 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -1536,11 +1536,6 @@ base_pages_alloc(size_t minsize) { #ifdef MALLOC_DSS - if (opt_dss) { - if (base_pages_alloc_dss(minsize) == false) - return (false); - } - if (opt_mmap && minsize != 0) #endif { @@ -1548,6 +1543,14 @@ base_pages_alloc(size_t minsize) return (false); } +#ifdef MALLOC_DSS + if (opt_dss) { + if (base_pages_alloc_dss(minsize) == false) + return (false); + } + +#endif + return (true); } @@ -1984,6 +1987,15 @@ chunk_alloc(size_t size, bool zero) assert((size & chunksize_mask) == 0); #ifdef MALLOC_DSS + if (opt_mmap) +#endif + { + ret = chunk_alloc_mmap(size); + if (ret != NULL) + goto RETURN; + } + +#ifdef MALLOC_DSS if (opt_dss) { ret = chunk_recycle_dss(size, zero); if (ret != NULL) { @@ -1994,14 +2006,7 @@ chunk_alloc(size_t size, bool zero) if (ret != NULL) goto RETURN; } - - if (opt_mmap) #endif - { - ret = chunk_alloc_mmap(size); - if (ret != NULL) - goto RETURN; - } /* All strategies for allocation failed. */ ret = NULL; |