mirror of
https://github.com/fluencelabs/redis
synced 2025-06-24 06:21:32 +00:00
Jemalloc updated to 4.4.0.
The original jemalloc source tree was modified to: 1. Remove the configure error that prevents nested builds. 2. Insert the Redis private Jemalloc API in order to allow the Redis fragmentation function to work.
This commit is contained in:
16
deps/jemalloc/test/unit/zero.c
vendored
16
deps/jemalloc/test/unit/zero.c
vendored
@ -8,39 +8,41 @@ const char *malloc_conf =
|
||||
static void
|
||||
test_zero(size_t sz_min, size_t sz_max)
|
||||
{
|
||||
char *s;
|
||||
uint8_t *s;
|
||||
size_t sz_prev, sz, i;
|
||||
#define MAGIC ((uint8_t)0x61)
|
||||
|
||||
sz_prev = 0;
|
||||
s = (char *)mallocx(sz_min, 0);
|
||||
s = (uint8_t *)mallocx(sz_min, 0);
|
||||
assert_ptr_not_null((void *)s, "Unexpected mallocx() failure");
|
||||
|
||||
for (sz = sallocx(s, 0); sz <= sz_max;
|
||||
sz_prev = sz, sz = sallocx(s, 0)) {
|
||||
if (sz_prev > 0) {
|
||||
assert_c_eq(s[0], 'a',
|
||||
assert_u_eq(s[0], MAGIC,
|
||||
"Previously allocated byte %zu/%zu is corrupted",
|
||||
ZU(0), sz_prev);
|
||||
assert_c_eq(s[sz_prev-1], 'a',
|
||||
assert_u_eq(s[sz_prev-1], MAGIC,
|
||||
"Previously allocated byte %zu/%zu is corrupted",
|
||||
sz_prev-1, sz_prev);
|
||||
}
|
||||
|
||||
for (i = sz_prev; i < sz; i++) {
|
||||
assert_c_eq(s[i], 0x0,
|
||||
assert_u_eq(s[i], 0x0,
|
||||
"Newly allocated byte %zu/%zu isn't zero-filled",
|
||||
i, sz);
|
||||
s[i] = 'a';
|
||||
s[i] = MAGIC;
|
||||
}
|
||||
|
||||
if (xallocx(s, sz+1, 0, 0) == sz) {
|
||||
s = (char *)rallocx(s, sz+1, 0);
|
||||
s = (uint8_t *)rallocx(s, sz+1, 0);
|
||||
assert_ptr_not_null((void *)s,
|
||||
"Unexpected rallocx() failure");
|
||||
}
|
||||
}
|
||||
|
||||
dallocx(s, 0);
|
||||
#undef MAGIC
|
||||
}
|
||||
|
||||
TEST_BEGIN(test_zero_small)
|
||||
|
Reference in New Issue
Block a user