Home | History | Annotate | Line # | Download | only in stress
      1 #include "test/jemalloc_test.h"
      2 #include "test/bench.h"
      3 
      4 static void
      5 large_mallocx_free(void) {
      6 	/*
      7 	 * We go a bit larger than the large minclass on its own to better
      8 	 * expose costs from things like zeroing.
      9 	 */
     10 	void *p = mallocx(SC_LARGE_MINCLASS, MALLOCX_TCACHE_NONE);
     11 	assert_ptr_not_null(p, "mallocx shouldn't fail");
     12 	free(p);
     13 }
     14 
     15 static void
     16 small_mallocx_free(void) {
     17 	void *p = mallocx(16, 0);
     18 	assert_ptr_not_null(p, "mallocx shouldn't fail");
     19 	free(p);
     20 }
     21 
     22 TEST_BEGIN(test_large_vs_small) {
     23 	compare_funcs(100*1000, 1*1000*1000, "large mallocx",
     24 	    large_mallocx_free, "small mallocx", small_mallocx_free);
     25 }
     26 TEST_END
     27 
     28 int
     29 main(void) {
     30 	return test_no_reentrancy(
     31 	    test_large_vs_small);
     32 }
     33 
     34