Home | History | Annotate | Line # | Download | only in unit
      1  1.1  christos #include "test/jemalloc_test.h"
      2  1.1  christos 
      3  1.1  christos const char *malloc_conf = "dirty_decay_ms:1000";
      4  1.1  christos const char *malloc_conf_2_conf_harder = "dirty_decay_ms:1234";
      5  1.1  christos 
      6  1.1  christos TEST_BEGIN(test_malloc_conf_2) {
      7  1.1  christos #ifdef _WIN32
      8  1.1  christos 	bool windows = true;
      9  1.1  christos #else
     10  1.1  christos 	bool windows = false;
     11  1.1  christos #endif
     12  1.1  christos 	/* Windows doesn't support weak symbol linker trickery. */
     13  1.1  christos 	test_skip_if(windows);
     14  1.1  christos 
     15  1.1  christos 	ssize_t dirty_decay_ms;
     16  1.1  christos 	size_t sz = sizeof(dirty_decay_ms);
     17  1.1  christos 
     18  1.1  christos 	int err = mallctl("opt.dirty_decay_ms", &dirty_decay_ms, &sz, NULL, 0);
     19  1.1  christos 	assert_d_eq(err, 0, "Unexpected mallctl failure");
     20  1.1  christos 	expect_zd_eq(dirty_decay_ms, 1234,
     21  1.1  christos 	    "malloc_conf_2 setting didn't take effect");
     22  1.1  christos }
     23  1.1  christos TEST_END
     24  1.1  christos 
     25  1.1  christos int
     26  1.1  christos main(void) {
     27  1.1  christos 	return test(
     28  1.1  christos 	    test_malloc_conf_2);
     29  1.1  christos }
     30