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