mirror of
https://github.com/fluencelabs/redis
synced 2025-07-30 16:01:57 +00:00
Jemalloc updated to 3.6.0.
Not a single bug in about 3 months, and our previous version was too old (3.2.0).
This commit is contained in:
45
deps/jemalloc/test/integration/mremap.c
vendored
Normal file
45
deps/jemalloc/test/integration/mremap.c
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
TEST_BEGIN(test_mremap)
|
||||
{
|
||||
int err;
|
||||
size_t sz, lg_chunk, chunksize, i;
|
||||
char *p, *q;
|
||||
|
||||
sz = sizeof(lg_chunk);
|
||||
err = mallctl("opt.lg_chunk", &lg_chunk, &sz, NULL, 0);
|
||||
assert_d_eq(err, 0, "Error in mallctl(): %s", strerror(err));
|
||||
chunksize = ((size_t)1U) << lg_chunk;
|
||||
|
||||
p = (char *)malloc(chunksize);
|
||||
assert_ptr_not_null(p, "malloc(%zu) --> %p", chunksize, p);
|
||||
memset(p, 'a', chunksize);
|
||||
|
||||
q = (char *)realloc(p, chunksize * 2);
|
||||
assert_ptr_not_null(q, "realloc(%p, %zu) --> %p", p, chunksize * 2,
|
||||
q);
|
||||
for (i = 0; i < chunksize; i++) {
|
||||
assert_c_eq(q[i], 'a',
|
||||
"realloc() should preserve existing bytes across copies");
|
||||
}
|
||||
|
||||
p = q;
|
||||
|
||||
q = (char *)realloc(p, chunksize);
|
||||
assert_ptr_not_null(q, "realloc(%p, %zu) --> %p", p, chunksize, q);
|
||||
for (i = 0; i < chunksize; i++) {
|
||||
assert_c_eq(q[i], 'a',
|
||||
"realloc() should preserve existing bytes across copies");
|
||||
}
|
||||
|
||||
free(q);
|
||||
}
|
||||
TEST_END
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
|
||||
return (test(
|
||||
test_mremap));
|
||||
}
|
Reference in New Issue
Block a user