diff --git a/newbrt/brtdump.c b/newbrt/brtdump.c index 74a33e09f2f450a6075463596ba77674c95beeaf..6c118376274f72bf1c1643ffe188349c113fcd59 100644 --- a/newbrt/brtdump.c +++ b/newbrt/brtdump.c @@ -453,7 +453,6 @@ main (int argc, const char *const argv[]) { dump_node_wrapper, &info, TRUE, TRUE); } toku_brtheader_free(h); - toku_malloc_cleanup(); return 0; } diff --git a/newbrt/tdb-recover.c b/newbrt/tdb-recover.c index 454cf5cdb6826fd6373bcae057bd09306307c962..c7f3e7672875186022447c9261a881b79fdb031c 100644 --- a/newbrt/tdb-recover.c +++ b/newbrt/tdb-recover.c @@ -41,6 +41,5 @@ int recovery_main (int argc, const char *const argv[]) { fprintf(stderr, "Recovery failed\n"); return(1); } - toku_malloc_cleanup(); return 0; } diff --git a/newbrt/tests/benchmark-test.c b/newbrt/tests/benchmark-test.c index c0f0a4d3f0c44d6e21f48d819f020d0faaee60ab..69be9d6483b6e19f6103f265fe95f14a80c145f5 100644 --- a/newbrt/tests/benchmark-test.c +++ b/newbrt/tests/benchmark-test.c @@ -194,10 +194,7 @@ test_main (int argc, const char *argv[]) { fflush(stdout); } unlink(fname); - if (verbose>1) { - toku_malloc_report(); - } - toku_malloc_cleanup(); + return 0; } diff --git a/newbrt/tests/brt-serialize-test.c b/newbrt/tests/brt-serialize-test.c index 4fd80fb4877a3032eefc3ee38d1284855d61bd42..2a23d00d0c54bddde9da947c9de86a7b74b9ce15 100644 --- a/newbrt/tests/brt-serialize-test.c +++ b/newbrt/tests/brt-serialize-test.c @@ -149,6 +149,5 @@ test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute_ toku_memory_check = 1; test_serialize_leaf(); test_serialize_nonleaf(); - toku_malloc_cleanup(); return 0; } diff --git a/newbrt/tests/brt-test-cursor-2.c b/newbrt/tests/brt-test-cursor-2.c index 932866fb0c2b4f2af42c1c05ddeba5829f14bd2d..90fb0ae3b2ed3de6ab448e79f1b873a979dd641b 100644 --- a/newbrt/tests/brt-test-cursor-2.c +++ b/newbrt/tests/brt-test-cursor-2.c @@ -102,8 +102,6 @@ test_main (int argc , const char *argv[]) { DB a_db; DB *db = &a_db; test_brt_cursor(db); - - toku_malloc_cleanup(); if (verbose) printf("test ok\n"); return 0; } diff --git a/newbrt/tests/brt-test-cursor.c b/newbrt/tests/brt-test-cursor.c index 8f0ac7a70133aa1908130b2a46f6df5968d86fee..e142bb2c87c41b682f51a49d0d58b346189182a3 100644 --- a/newbrt/tests/brt-test-cursor.c +++ b/newbrt/tests/brt-test-cursor.c @@ -885,40 +885,40 @@ static void test_brt_cursor(DB *db) { test_multiple_brt_cursors(3, db); for (n=0; n<test_brt_cursor_limit; n += test_brt_cursor_inc) { - test_brt_cursor_first(n, db); toku_memory_check_all_free(); + test_brt_cursor_first(n, db); } for (n=0; n<test_brt_cursor_limit; n += test_brt_cursor_inc) { - test_brt_cursor_rfirst(n, db); toku_memory_check_all_free(); + test_brt_cursor_rfirst(n, db); } for (n=0; n<test_brt_cursor_limit; n += test_brt_cursor_inc) { - test_brt_cursor_walk(n, db); toku_memory_check_all_free(); + test_brt_cursor_walk(n, db); } for (n=0; n<test_brt_cursor_limit; n += test_brt_cursor_inc) { - test_brt_cursor_last(n, db); toku_memory_check_all_free(); + test_brt_cursor_last(n, db); } for (n=0; n<test_brt_cursor_limit; n += test_brt_cursor_inc) { - test_brt_cursor_first_last(n, db); toku_memory_check_all_free(); + test_brt_cursor_first_last(n, db); } for (n=0; n<test_brt_cursor_limit; n += test_brt_cursor_inc) { - test_brt_cursor_split(n, db); toku_memory_check_all_free(); + test_brt_cursor_split(n, db); } for (n=0; n<test_brt_cursor_limit; n += test_brt_cursor_inc) { - test_brt_cursor_rand(n, db); toku_memory_check_all_free(); + test_brt_cursor_rand(n, db); } for (n=0; n<test_brt_cursor_limit; n += test_brt_cursor_inc) { - test_brt_cursor_rwalk(n, db); toku_memory_check_all_free(); + test_brt_cursor_rwalk(n, db); } - test_brt_cursor_set(1000, DB_SET, db); toku_memory_check_all_free(); - test_brt_cursor_set(10000, DB_SET, db); toku_memory_check_all_free(); - test_brt_cursor_set(1000, DB_SET_RANGE, db); toku_memory_check_all_free(); - test_brt_cursor_set_range(1000, db); toku_memory_check_all_free(); - test_brt_cursor_set_range(10000, db); toku_memory_check_all_free(); + test_brt_cursor_set(1000, DB_SET, db); + test_brt_cursor_set(10000, DB_SET, db); + test_brt_cursor_set(1000, DB_SET_RANGE, db); + test_brt_cursor_set_range(1000, db); + test_brt_cursor_set_range(10000, db); - test_brt_cursor_delete(1000, db); toku_memory_check_all_free(); - test_multiple_brt_cursor_walk(10000, db); toku_memory_check_all_free(); - test_multiple_brt_cursor_walk(100000, db); toku_memory_check_all_free(); + test_brt_cursor_delete(1000, db); + test_multiple_brt_cursor_walk(10000, db); + test_multiple_brt_cursor_walk(100000, db); } @@ -929,8 +929,6 @@ test_main (int argc , const char *argv[]) { DB a_db; DB *db = &a_db; test_brt_cursor(db); - - toku_malloc_cleanup(); if (verbose) printf("test ok\n"); return 0; } diff --git a/newbrt/tests/brt-test.c b/newbrt/tests/brt-test.c index 08b03d388048f4aca0f2517bb5183c5b82cad3e5..37fd9f5465af35c24e6b0aa861a45844dd50255a 100644 --- a/newbrt/tests/brt-test.c +++ b/newbrt/tests/brt-test.c @@ -22,7 +22,7 @@ static void test_dump_empty_db (void) { if (verbose) toku_dump_brt(stdout, t); r = toku_close_brt(t, 0); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + } /* Test running multiple trees in different files */ @@ -35,7 +35,7 @@ static void test_multiple_files_of_size (int size) { if (verbose) printf("test_multiple_files_of_size(%d)\n", size); unlink(n0); unlink(n1); - toku_memory_check_all_free(); + r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_open_brt(n0, 1, &t0, size, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0); r = toku_open_brt(n1, 1, &t1, size, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0); @@ -57,7 +57,7 @@ static void test_multiple_files_of_size (int size) { r = toku_close_brt(t0, 0); assert(r==0); r = toku_close_brt(t1, 0); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + /* Now see if the data is all there. */ r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); @@ -78,7 +78,7 @@ static void test_multiple_files_of_size (int size) { r = toku_close_brt(t0, 0); assert(r==0); r = toku_close_brt(t1, 0); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + } static void test_multiple_files (void) { @@ -93,7 +93,7 @@ static void test_multiple_brts_one_db_one_file (void) { CACHETABLE ct; BRT trees[MANYN]; if (verbose) printf("test_multiple_brts_one_db_one_file:"); - toku_memory_check_all_free(); + unlink(fname); r = toku_brt_create_cachetable(&ct, 32, ZERO_LSN, NULL_LOGGER); assert(r==0); for (i=0; i<MANYN; i++) { @@ -117,7 +117,7 @@ static void test_multiple_brts_one_db_one_file (void) { r=toku_close_brt(trees[i], 0); assert(r==0); } r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + if (verbose) printf(" ok\n"); } @@ -132,14 +132,14 @@ static void test_read_what_was_written (void) { if (verbose) printf("test_read_what_was_written(): "); fflush(stdout); unlink(fname); - toku_memory_check_all_free(); + r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_open_brt(fname, 1, &brt, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0); r = toku_close_brt(brt, 0); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + /* Now see if we can read an empty tree in. */ r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); @@ -154,7 +154,7 @@ static void test_read_what_was_written (void) { r = toku_close_brt(brt, 0); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + /* Now see if we can read it in and get the value. */ r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); @@ -216,7 +216,7 @@ static void test_read_what_was_written (void) { if (verbose) printf("%s:%d About to close %p\n", __FILE__, __LINE__, ct); r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_open_brt(fname, 0, &brt, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0); @@ -235,7 +235,7 @@ static void test_read_what_was_written (void) { r = toku_close_brt(brt, 0); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + if (verbose) printf(" ok\n"); @@ -249,7 +249,7 @@ static void test_cursor_last_empty(void) { int r; if (verbose) printf("%s", __FUNCTION__); unlink(fname); - toku_memory_check_all_free(); + //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); @@ -272,7 +272,7 @@ static void test_cursor_last_empty(void) { //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); r = toku_cachetable_close(&ct); assert(r==0); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); - toku_memory_check_all_free(); + } static void test_cursor_next (void) { @@ -283,7 +283,7 @@ static void test_cursor_next (void) { DBT kbt, vbt; unlink(fname); - toku_memory_check_all_free(); + r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); r = toku_open_brt(fname, 1, &brt, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0); @@ -323,7 +323,7 @@ static void test_cursor_next (void) { //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); r = toku_cachetable_close(&ct); assert(r==0); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); - toku_memory_check_all_free(); + } @@ -351,7 +351,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) { unsigned int i; unlink(fname); - toku_memory_check_all_free(); + { char a[4]={0,1,0,0}; @@ -442,7 +442,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) { assert(r==0); } r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + } static int test_brt_cursor_keycompare(DB *db __attribute__((unused)), const DBT *a, const DBT *b) { @@ -487,7 +487,7 @@ static void test_brt_limits(void) { int bsize = 1024; int kvsize = 4; while (kvsize < bsize/2) { - test_large_kv(bsize, kvsize, kvsize); toku_memory_check_all_free(); + test_large_kv(bsize, kvsize, kvsize); kvsize *= 2; } } @@ -774,19 +774,19 @@ static void test_insert_delete_lookup(int n) { static void test_brt_delete(void) { - test_brt_delete_empty(); toku_memory_check_all_free(); - test_brt_delete_present(1); toku_memory_check_all_free(); - test_brt_delete_present(100); toku_memory_check_all_free(); - test_brt_delete_present(500); toku_memory_check_all_free(); - test_brt_delete_not_present(1); toku_memory_check_all_free(); - test_brt_delete_not_present(100); toku_memory_check_all_free(); - test_brt_delete_not_present(500); toku_memory_check_all_free(); - test_brt_delete_cursor_first(1); toku_memory_check_all_free(); - test_brt_delete_cursor_first(100); toku_memory_check_all_free(); - test_brt_delete_cursor_first(500); toku_memory_check_all_free(); - test_brt_delete_cursor_first(10000); toku_memory_check_all_free(); - test_insert_delete_lookup(2); toku_memory_check_all_free(); - test_insert_delete_lookup(512); toku_memory_check_all_free(); + test_brt_delete_empty(); + test_brt_delete_present(1); + test_brt_delete_present(100); + test_brt_delete_present(500); + test_brt_delete_not_present(1); + test_brt_delete_not_present(100); + test_brt_delete_not_present(500); + test_brt_delete_cursor_first(1); + test_brt_delete_cursor_first(100); + test_brt_delete_cursor_first(500); + test_brt_delete_cursor_first(10000); + test_insert_delete_lookup(2); + test_insert_delete_lookup(512); } static void test_new_brt_cursor_create_close (void) { @@ -1207,33 +1207,33 @@ static void test_new_brt_cursor_set(int n, int cursor_op, DB *db) { static void test_new_brt_cursors(int dup_mode) { assert(dup_mode==0); - test_new_brt_cursor_create_close(); toku_memory_check_all_free(); - test_new_brt_cursor_first(8, dup_mode); toku_memory_check_all_free(); - test_new_brt_cursor_last(8, dup_mode); toku_memory_check_all_free(); - test_new_brt_cursor_last(512, dup_mode); toku_memory_check_all_free(); - test_new_brt_cursor_next(8, dup_mode); toku_memory_check_all_free(); - test_new_brt_cursor_prev(8, dup_mode); toku_memory_check_all_free(); - test_new_brt_cursor_current(8, dup_mode); toku_memory_check_all_free(); - test_new_brt_cursor_next(512, dup_mode); toku_memory_check_all_free(); - test_new_brt_cursor_set_range(512, dup_mode); toku_memory_check_all_free(); - test_new_brt_cursor_set(512, DB_SET, 0); toku_memory_check_all_free(); + test_new_brt_cursor_create_close(); + test_new_brt_cursor_first(8, dup_mode); + test_new_brt_cursor_last(8, dup_mode); + test_new_brt_cursor_last(512, dup_mode); + test_new_brt_cursor_next(8, dup_mode); + test_new_brt_cursor_prev(8, dup_mode); + test_new_brt_cursor_current(8, dup_mode); + test_new_brt_cursor_next(512, dup_mode); + test_new_brt_cursor_set_range(512, dup_mode); + test_new_brt_cursor_set(512, DB_SET, 0); } static void brt_blackbox_test (void) { toku_memory_check = 1; - test_wrongendian_compare(0, 2); toku_memory_check_all_free(); - test_wrongendian_compare(1, 2); toku_memory_check_all_free(); - test_wrongendian_compare(1, 257); toku_memory_check_all_free(); - test_wrongendian_compare(1, 1000); toku_memory_check_all_free(); + test_wrongendian_compare(0, 2); + test_wrongendian_compare(1, 2); + test_wrongendian_compare(1, 257); + test_wrongendian_compare(1, 1000); test_new_brt_cursors(0); - test_read_what_was_written(); toku_memory_check_all_free(); if (verbose) printf("did read_what_was_written\n"); - test_cursor_next(); toku_memory_check_all_free(); - test_cursor_last_empty(); toku_memory_check_all_free(); - test_multiple_brts_one_db_one_file(); toku_memory_check_all_free(); - test_dump_empty_db(); toku_memory_check_all_free(); - toku_memory_check_all_free(); - toku_memory_check_all_free(); + test_read_what_was_written(); if (verbose) printf("did read_what_was_written\n"); + test_cursor_next(); + test_cursor_last_empty(); + test_multiple_brts_one_db_one_file(); + test_dump_empty_db(); + + if (verbose) printf("test_multiple_files\n"); test_multiple_files(); @@ -1260,7 +1260,6 @@ test_main (int argc , const char *argv[]) { default_parse_args(argc, argv); brt_blackbox_test(); - toku_malloc_cleanup(); if (verbose) printf("test ok\n"); return 0; } diff --git a/newbrt/tests/brt-test0.c b/newbrt/tests/brt-test0.c index d2625cc7f08348b00dfcbc917de761204a8c99ce..1f1374d141814dbf4cad3c45648dd40018673585 100644 --- a/newbrt/tests/brt-test0.c +++ b/newbrt/tests/brt-test0.c @@ -14,7 +14,7 @@ static void test0 (void) { char fname[]= __FILE__ "0.brt"; if (verbose) printf("%s:%d test0\n", __FILE__, __LINE__); toku_memory_check=1; - toku_memory_check_all_free(); + r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); if (verbose) printf("%s:%d test0\n", __FILE__, __LINE__); @@ -27,7 +27,7 @@ static void test0 (void) { //printf("%s:%d n_items_malloced=%lld\n", __FILE__, __LINE__, n_items_malloced); r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + } int @@ -37,7 +37,7 @@ test_main (int argc , const char *argv[]) { test0(); if (verbose) printf("test0 B\n"); test0(); /* Make sure it works twice. */ - toku_malloc_cleanup(); + if (verbose) printf("test0 ok\n"); return 0; } diff --git a/newbrt/tests/brt-test1.c b/newbrt/tests/brt-test1.c index a9b53a70fc4a9750ebbab9064bd1c1117e5125d0..d2b95367c3d2d6f9b272804b19d32ad9dafd4519 100644 --- a/newbrt/tests/brt-test1.c +++ b/newbrt/tests/brt-test1.c @@ -14,7 +14,7 @@ static void test1 (void) { char fname[]= __FILE__ "1.brt"; DBT k,v; toku_memory_check=1; - toku_memory_check_all_free(); + r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); unlink(fname); @@ -29,7 +29,7 @@ static void test1 (void) { } r = toku_close_brt(t, 0); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + if (verbose) printf("test1 ok\n"); } int @@ -37,7 +37,7 @@ test_main (int argc , const char *argv[]) { default_parse_args(argc, argv); if (verbose) printf("test1\n"); test1(); - toku_malloc_cleanup(); + if (verbose) printf("test1 ok\n"); return 0; } diff --git a/newbrt/tests/brt-test2.c b/newbrt/tests/brt-test2.c index 5023e26f2da9bf25c48534bd2b74fe940e2cf1b5..91cd719f694dbc271a61fc441b38877b027d2ef1 100644 --- a/newbrt/tests/brt-test2.c +++ b/newbrt/tests/brt-test2.c @@ -15,7 +15,7 @@ static void test2 (int memcheck, int limit) { char fname[]= __FILE__ "2.brt"; toku_memory_check=memcheck; if (verbose) printf("%s:%d checking\n", __FILE__, __LINE__); - toku_memory_check_all_free(); + r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); unlink(fname); r = toku_open_brt(fname, 1, &t, 1024, ct, null_txn, toku_builtin_compare_fun, null_db); @@ -43,7 +43,7 @@ static void test2 (int memcheck, int limit) { r = toku_verify_brt(t); assert(r==0); r = toku_close_brt(t, 0); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + if (verbose) printf("test2 ok\n"); } @@ -57,7 +57,7 @@ test_main (int argc , const char *argv[]) { test2(0, 27); test2(0, 212); test2(0, 4096); - toku_malloc_cleanup(); + if (verbose) printf("test1 ok\n"); return 0; } diff --git a/newbrt/tests/brt-test3.c b/newbrt/tests/brt-test3.c index 36b17a53915d8ae1bb979b046b51f78ec205410b..49c0c31e420317c7629543d0ce715f2db1a9ccf4 100644 --- a/newbrt/tests/brt-test3.c +++ b/newbrt/tests/brt-test3.c @@ -17,7 +17,7 @@ static void test3 (int nodesize, int count, int memcheck) { int i; CACHETABLE ct; toku_memory_check=memcheck; - toku_memory_check_all_free(); + r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); gettimeofday(&t0, 0); unlink(fname); @@ -33,7 +33,7 @@ static void test3 (int nodesize, int count, int memcheck) { r = toku_verify_brt(t); assert(r==0); r = toku_close_brt(t, 0); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + gettimeofday(&t1, 0); { double diff = toku_tdiff(&t1, &t0); @@ -71,7 +71,7 @@ test_main (int argc , const char *argv[]) { default_parse_args(argc, argv); brt_blackbox_test(); - toku_malloc_cleanup(); + if (verbose) printf("test ok\n"); return 0; } diff --git a/newbrt/tests/brt-test4.c b/newbrt/tests/brt-test4.c index 9a74c1d096732d0fd7fa5f46e7c3ede948161054..1a5885bc00aaafc8d03c9c0dee1fa69763b429e5 100644 --- a/newbrt/tests/brt-test4.c +++ b/newbrt/tests/brt-test4.c @@ -19,7 +19,7 @@ static void test4 (int nodesize, int count, int memcheck) { gettimeofday(&t0, 0); unlink(fname); toku_memory_check=memcheck; - toku_memory_check_all_free(); + r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_open_brt(fname, 1, &t, nodesize, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0); for (i=0; i<count; i++) { @@ -33,7 +33,7 @@ static void test4 (int nodesize, int count, int memcheck) { r = toku_verify_brt(t); assert(r==0); r = toku_close_brt(t, 0); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + gettimeofday(&t1, 0); { double diff = toku_tdiff(&t1, &t0); @@ -65,7 +65,7 @@ test_main (int argc , const char *argv[]) { default_parse_args(argc, argv); brt_blackbox_test(); - toku_malloc_cleanup(); + if (verbose) printf("test ok\n"); return 0; } diff --git a/newbrt/tests/brt-test5.c b/newbrt/tests/brt-test5.c index 87aeb2e446c2444d82133bd98a6a6a2cbdf8dfaa..ef7232edc14578cff3897658478c4d61013aa045 100644 --- a/newbrt/tests/brt-test5.c +++ b/newbrt/tests/brt-test5.c @@ -15,7 +15,7 @@ static void test5 (void) { int i; CACHETABLE ct; char fname[]= __FILE__ ".brt"; - toku_memory_check_all_free(); + MALLOC_N(limit,values); for (i=0; i<limit; i++) values[i]=-1; unlink(fname); @@ -51,7 +51,7 @@ static void test5 (void) { toku_free(values); r = toku_close_brt(t, 0); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0); - toku_memory_check_all_free(); + } int @@ -59,7 +59,7 @@ test_main (int argc , const char *argv[]) { default_parse_args(argc, argv); test5(); - toku_malloc_cleanup(); + if (verbose) printf("test ok\n"); return 0; } diff --git a/newbrt/tests/brtloader-error-injector.h b/newbrt/tests/brtloader-error-injector.h index 044d746fd946a99807b3329ac3ef7b237bb96e37..5c7c07b90307e5ef306bda21dac1f5bc5b2a4916 100644 --- a/newbrt/tests/brtloader-error-injector.h +++ b/newbrt/tests/brtloader-error-injector.h @@ -110,7 +110,7 @@ static void *my_malloc(size_t n) { (void) toku_sync_fetch_and_increment_int32(&my_big_malloc_count); // my_big_malloc_count++; if (do_malloc_errors) { caller = __builtin_return_address(1); - if ((void*)toku_xmalloc <= caller && caller <= (void*)toku_malloc_report) + if ((void*)toku_xmalloc <= caller && caller <= (void*)toku_set_func_malloc) goto skip; if (event_add_and_fetch()== event_count_trigger) { event_hit(); @@ -135,7 +135,7 @@ static void *my_realloc(void *p, size_t n) { (void) toku_sync_increment_and_fetch_int32(&my_big_realloc_count); // my_big_realloc_count++; if (do_realloc_errors) { caller = __builtin_return_address(1); - if ((void*)toku_xrealloc <= caller && caller <= (void*)toku_malloc_report) + if ((void*)toku_xrealloc <= caller && caller <= (void*)toku_set_func_malloc) goto skip; if (event_add_and_fetch() == event_count_trigger) { event_hit(); diff --git a/newbrt/tests/brtloader-test-merge-files-dbufio.c b/newbrt/tests/brtloader-test-merge-files-dbufio.c index d4399609c821b48eb96d8bb71aa8c11806cede95..79a46ae1d25aabce9259e30910e68377577c7364 100644 --- a/newbrt/tests/brtloader-test-merge-files-dbufio.c +++ b/newbrt/tests/brtloader-test-merge-files-dbufio.c @@ -184,7 +184,7 @@ static void *my_malloc(size_t n) { my_big_malloc_count++; if (my_malloc_event) { caller = __builtin_return_address(1); - if ((void*)toku_xmalloc <= caller && caller <= (void*)toku_malloc_report) + if ((void*)toku_xmalloc <= caller && caller <= (void*)toku_set_func_malloc) goto skip; event_count++; if (event_count == event_count_trigger) { @@ -210,7 +210,7 @@ static void *my_realloc(void *p, size_t n) { my_big_realloc_count++; if (do_realloc_errors) { caller = __builtin_return_address(1); - if ((void*)toku_xrealloc <= caller && caller <= (void*)toku_malloc_report) + if ((void*)toku_xrealloc <= caller && caller <= (void*)toku_set_func_malloc) goto skip; event_count++; if (event_count == event_count_trigger) { diff --git a/newbrt/tests/cachetable-test.c b/newbrt/tests/cachetable-test.c index 29428fea87946f199ac54087ca751948a264b6fb..311207f6d8ccd5ab86a92886330890b0597b845c 100644 --- a/newbrt/tests/cachetable-test.c +++ b/newbrt/tests/cachetable-test.c @@ -294,7 +294,7 @@ static void test0 (void) { assert(r==0); assert(expect_n_flushes==0); expect_f = 0; - toku_memory_check_all_free(); + } static void flush_n (CACHEFILE f __attribute__((__unused__)), int UU(fd), CACHEKEY key __attribute__((__unused__)), @@ -745,7 +745,7 @@ test_main (int argc, const char *argv[]) { } test_mutex_destroy(); - toku_malloc_cleanup(); + if (verbose) printf("ok\n"); return 0; } diff --git a/newbrt/tests/cachetable-test2.c b/newbrt/tests/cachetable-test2.c index a5cf841fec12044ef95526952707ed24c261ca8c..334b6ca8f075fd254dabbf9be6e88379b252a777 100644 --- a/newbrt/tests/cachetable-test2.c +++ b/newbrt/tests/cachetable-test2.c @@ -250,7 +250,7 @@ test_main (int argc, const char *argv[]) { test_mutex_init(); test_chaining(); test_mutex_destroy(); - toku_malloc_cleanup(); + if (verbose) printf("ok\n"); return 0; } diff --git a/newbrt/tests/fifo-test.c b/newbrt/tests/fifo-test.c index 89bf589505cf3862b146dcc176a775b25406a466..0ab29b5beb0d428d7817ea028469012d4b4ab6a9 100644 --- a/newbrt/tests/fifo-test.c +++ b/newbrt/tests/fifo-test.c @@ -87,6 +87,6 @@ test_main(int argc, const char *argv[]) { test_fifo_create(); test_fifo_enq(4); test_fifo_enq(512); - toku_malloc_cleanup(); + return 0; } diff --git a/newbrt/tests/keyrange-unflat.c b/newbrt/tests/keyrange-unflat.c index 8c444b97addb815bde3b4824228d5fc75dd22f31..201f3cbd420192ec3b5df8c02f7ca8ab3437184d 100644 --- a/newbrt/tests/keyrange-unflat.c +++ b/newbrt/tests/keyrange-unflat.c @@ -65,7 +65,7 @@ test_main (int argc , const char *argv[]) { default_parse_args(argc, argv); test_flat(); - toku_malloc_cleanup(); + if (verbose) printf("test ok\n"); return 0; } diff --git a/newbrt/tests/keyrange.c b/newbrt/tests/keyrange.c index 108e11083c57c5cb3e05a6a3a0429c740c6399e8..e2bda1101be3afc485c7711cf9f1a5be6d347a26 100644 --- a/newbrt/tests/keyrange.c +++ b/newbrt/tests/keyrange.c @@ -69,7 +69,7 @@ test_main (int argc , const char *argv[]) { default_parse_args(argc, argv); test_flat(); - toku_malloc_cleanup(); + if (verbose) printf("test ok\n"); return 0; } diff --git a/newbrt/tests/test-brt-overflow.c b/newbrt/tests/test-brt-overflow.c index 35960dab3a3bcf63a50d40104cf3c5c1ffde6327..0717d48c47ae1852ac36c49541fddc0adb64b9ee 100644 --- a/newbrt/tests/test-brt-overflow.c +++ b/newbrt/tests/test-brt-overflow.c @@ -45,6 +45,6 @@ test_main (int argc, const char *argv[]) { verbose = 0; } test_overflow(); - toku_malloc_cleanup(); + return 0; } diff --git a/newbrt/tests/test-inc-split.c b/newbrt/tests/test-inc-split.c index 91b0c973012826ced0c99c981d76256ae3a9c371..cc21925b2b29c982013ccca263aa03440c83f97b 100644 --- a/newbrt/tests/test-inc-split.c +++ b/newbrt/tests/test-inc-split.c @@ -151,6 +151,6 @@ test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute_ } } #endif - toku_malloc_cleanup(); + return 0; } diff --git a/newbrt/tests/ybt-test.c b/newbrt/tests/ybt-test.c index 25fffb9b559ab4f318a5590602758b1bcc6021c6..0bb7b7af475165f8c0a3e0864328f547dbf4bb09 100644 --- a/newbrt/tests/ybt-test.c +++ b/newbrt/tests/ybt-test.c @@ -47,7 +47,7 @@ static void ybt_test0 (void) { cleanup_and_free(&v0); cleanup_and_free(&v1); - toku_memory_check_all_free(); + /* See if we can probe to find out how big something is by setting ulen=0 with YBT_USERMEM */ toku_init_dbt(&t0); @@ -80,7 +80,7 @@ static void ybt_test0 (void) { assert(strcmp(t0.data, "provincial")==0); toku_free(t0.data); - toku_memory_check_all_free(); + } int diff --git a/src/ydb.c b/src/ydb.c index 820498bdea0a007e10eced6fba2c483d53490652..f74801773df4c19a6f1387e56f132402e91e7391 100644 --- a/src/ydb.c +++ b/src/ydb.c @@ -137,21 +137,6 @@ ydb_getf_do_nothing(DBT const* UU(key), DBT const* UU(val), void* UU(extra)) { return 0; } -/* the ydb reference is used to cleanup the library when there are no more references to it */ -static int toku_ydb_refs = 0; - -static inline void ydb_add_ref(void) { - ++toku_ydb_refs; -} - -static inline void ydb_unref(void) { - assert(toku_ydb_refs > 0); - if (--toku_ydb_refs == 0) { - /* call global destructors */ - toku_malloc_cleanup(); - } -} - /* env methods */ static int toku_env_close(DB_ENV *env, u_int32_t flags); static int toku_env_set_data_dir(DB_ENV * env, const char *dir); @@ -935,7 +920,6 @@ static int toku_env_close(DB_ENV * env, u_int32_t flags) { env->i = NULL; toku_free(env); env = NULL; - ydb_unref(); if ((flags!=0) && !(flags==DB_CLOSE_DONT_TRIM_LOG)) r = EINVAL; return r; @@ -1829,7 +1813,6 @@ static int toku_env_create(DB_ENV ** envp, u_int32_t flags) { assert(result->i->open_dbs); } - ydb_add_ref(); *envp = result; r = 0; cleanup: @@ -2272,7 +2255,6 @@ db_close_before_brt(DB *db, u_int32_t UU(flags)) { if (db->i->dname) toku_free(db->i->dname); toku_free(db->i); toku_free(db); - ydb_unref(); if (r1) return r1; if (r2) return r2; if (is_panicked) return EINVAL; @@ -4880,7 +4862,6 @@ static int toku_db_create(DB ** db, DB_ENV * env, u_int32_t flags) { toku_free(result); return r; } - ydb_add_ref(); *db = result; return 0; } diff --git a/windows/memory.c b/windows/memory.c index c84680a61c687d4d8c31eab080bdd6c9b528e1ea..1647d4e0cd1a1a6d13d113be151919ec3c46c14a 100644 --- a/windows/memory.c +++ b/windows/memory.c @@ -113,32 +113,6 @@ toku_xstrdup (const char *s) return toku_xmemdup(s, strlen(s)+1); } -void -toku_memory_check_all_free (void) -{ -} - -int -toku_get_n_items_malloced (void) -{ - return 0; -} - -void -toku_print_malloced_items (void) -{ -} - -void -toku_malloc_report (void) -{ -} - -void -toku_malloc_cleanup (void) -{ -} - int toku_set_func_malloc(malloc_fun_t f) { t_malloc = f;