summaryrefslogtreecommitdiff
path: root/slabs.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2020-03-26 11:24:20 -0700
committerdormando <dormando@rydia.net>2020-03-26 11:24:20 -0700
commitcb0de8114921f09adf97397b08b238fbcb9f8ab4 (patch)
tree14740530f450b3acfc7c9e9468a9c8c980e5f9ee /slabs.c
parent5174ef33576f461d43f43b2019f5e10655b4c78f (diff)
downloadmemcached-cb0de8114921f09adf97397b08b238fbcb9f8ab4.tar.gz
restart: always wipe memory from global pool
An ifdef was added for FreeBSD at some point since it gives you 0'd out memory from malloc, but memory from the global pool isn't always from malloc.
Diffstat (limited to 'slabs.c')
-rw-r--r--slabs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/slabs.c b/slabs.c
index 89a51ed..56b5840 100644
--- a/slabs.c
+++ b/slabs.c
@@ -381,9 +381,11 @@ static int do_slabs_newslab(const unsigned int id) {
return 0;
}
-#if !defined(__FreeBSD__)
+ // Always wipe the memory at this stage: in restart mode the mmap memory
+ // could be unused, yet still full of data. Better for usability if we're
+ // wiping memory as it's being pulled out of the global pool instead of
+ // blocking startup all at once.
memset(ptr, 0, (size_t)len);
-#endif
split_slab_page_into_freelist(ptr, id);
p->slab_list[p->slabs++] = ptr;