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