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:
51
deps/jemalloc/test/unit/prof_idump.c
vendored
Normal file
51
deps/jemalloc/test/unit/prof_idump.c
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
const char *malloc_conf =
|
||||
"prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0,"
|
||||
"lg_prof_interval:0";
|
||||
#endif
|
||||
|
||||
static bool did_prof_dump_open;
|
||||
|
||||
static int
|
||||
prof_dump_open_intercept(bool propagate_err, const char *filename)
|
||||
{
|
||||
int fd;
|
||||
|
||||
did_prof_dump_open = true;
|
||||
|
||||
fd = open("/dev/null", O_WRONLY);
|
||||
assert_d_ne(fd, -1, "Unexpected open() failure");
|
||||
|
||||
return (fd);
|
||||
}
|
||||
|
||||
TEST_BEGIN(test_idump)
|
||||
{
|
||||
bool active;
|
||||
void *p;
|
||||
|
||||
test_skip_if(!config_prof);
|
||||
|
||||
active = true;
|
||||
assert_d_eq(mallctl("prof.active", NULL, NULL, &active, sizeof(active)),
|
||||
0, "Unexpected mallctl failure while activating profiling");
|
||||
|
||||
prof_dump_open = prof_dump_open_intercept;
|
||||
|
||||
did_prof_dump_open = false;
|
||||
p = mallocx(1, 0);
|
||||
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
||||
dallocx(p, 0);
|
||||
assert_true(did_prof_dump_open, "Expected a profile dump");
|
||||
}
|
||||
TEST_END
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
|
||||
return (test(
|
||||
test_idump));
|
||||
}
|
Reference in New Issue
Block a user