diff options
author | jasone <jasone@FreeBSD.org> | 2012-04-22 08:49:13 +0000 |
---|---|---|
committer | jasone <jasone@FreeBSD.org> | 2012-04-22 08:49:13 +0000 |
commit | b378da045b65724c107c298a068d631553a3beea (patch) | |
tree | bb74ef462b9c9eeb4d5138d777ba402363012806 /contrib/jemalloc/src/huge.c | |
parent | 0f83f74ce126b08c5fe9eeb2e3ffe9025ef37802 (diff) | |
download | FreeBSD-src-b378da045b65724c107c298a068d631553a3beea.zip FreeBSD-src-b378da045b65724c107c298a068d631553a3beea.tar.gz |
Import jemalloc a8f8d7540d66ddee7337db80c92890916e1063ca (dev branch,
prior to 3.0.0 release). This fixes several bugs related to memory
initialization.
Mangle __jemalloc_a0{malloc,calloc,free}() just like all the other
library-internal symbols in jemalloc, and adjust the tls allocation code
in libc to use the mangled names.
Diffstat (limited to 'contrib/jemalloc/src/huge.c')
-rw-r--r-- | contrib/jemalloc/src/huge.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/contrib/jemalloc/src/huge.c b/contrib/jemalloc/src/huge.c index daf0c62..23eb074 100644 --- a/contrib/jemalloc/src/huge.c +++ b/contrib/jemalloc/src/huge.c @@ -28,6 +28,7 @@ huge_palloc(size_t size, size_t alignment, bool zero) void *ret; size_t csize; extent_node_t *node; + bool is_zeroed; /* Allocate one or more contiguous chunks for this request. */ @@ -42,7 +43,12 @@ huge_palloc(size_t size, size_t alignment, bool zero) if (node == NULL) return (NULL); - ret = chunk_alloc(csize, alignment, false, &zero); + /* + * Copy zero into is_zeroed and pass the copy to chunk_alloc(), so that + * it is possible to make correct junk/zero fill decisions below. + */ + is_zeroed = zero; + ret = chunk_alloc(csize, alignment, false, &is_zeroed); if (ret == NULL) { base_node_dealloc(node); return (NULL); @@ -64,7 +70,7 @@ huge_palloc(size_t size, size_t alignment, bool zero) if (config_fill && zero == false) { if (opt_junk) memset(ret, 0xa5, csize); - else if (opt_zero) + else if (opt_zero && is_zeroed == false) memset(ret, 0, csize); } |