summaryrefslogtreecommitdiffstats
path: root/src/chunk_dss.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2012-04-21 23:04:51 (GMT)
committerJason Evans <jasone@canonware.com>2012-04-21 23:04:51 (GMT)
commit7ad54c1c30e0805e0758690115875f982de46cf2 (patch)
tree2c7b57e68793413aaa3370b5e66e7cb0e208dcbe /src/chunk_dss.c
parent8f0e0eb1c01d5d934586ea62e519ca8b8637aebc (diff)
downloadjemalloc-7ad54c1c30e0805e0758690115875f982de46cf2.zip
jemalloc-7ad54c1c30e0805e0758690115875f982de46cf2.tar.gz
jemalloc-7ad54c1c30e0805e0758690115875f982de46cf2.tar.bz2
Fix chunk allocation/deallocation bugs.
Fix chunk_alloc_dss() to zero memory when requested. Fix chunk_dealloc() to avoid chunk_dealloc_mmap() for dss-allocated memory. Fix huge_palloc() to always junk fill when requested. Improve chunk_recycle() to report that memory is zeroed as a side effect of pages_purge().
Diffstat (limited to 'src/chunk_dss.c')
-rw-r--r--src/chunk_dss.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/chunk_dss.c b/src/chunk_dss.c
index bd4a724..2d68e48 100644
--- a/src/chunk_dss.c
+++ b/src/chunk_dss.c
@@ -89,6 +89,10 @@ chunk_alloc_dss(size_t size, size_t alignment, bool *zero)
malloc_mutex_unlock(&dss_mtx);
if (cpad_size != 0)
chunk_dealloc(cpad, cpad_size, true);
+ if (*zero) {
+ VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
+ memset(ret, 0, size);
+ }
return (ret);
}
} while (dss_prev != (void *)-1);