malloc_conf_2.c 681 B

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