Commit 945673e8 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

#2921 refs[t:2921] remove obsolete memory functions

git-svn-id: file:///svn/toku/tokudb@23625 c7de825b-a66e-492c-adef-691d508d4ae1
parent 3e391840
......@@ -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;
}
......
......@@ -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;
}
......@@ -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;
}
......@@ -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;
}
......@@ -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;
}
......@@ -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;
}
This diff is collapsed.
......@@ -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;
}
......@@ -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;
}
......@@ -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;
}
......@@ -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;
}
......@@ -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;
}
......@@ -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;
}
......@@ -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();
......
......@@ -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) {
......
......@@ -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;
}
......@@ -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;
}
......@@ -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;
}
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -45,6 +45,6 @@ test_main (int argc, const char *argv[]) {
verbose = 0;
}
test_overflow();
toku_malloc_cleanup();
return 0;
}
......@@ -151,6 +151,6 @@ test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute_
}
}
#endif
toku_malloc_cleanup();
return 0;
}
......@@ -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
......
......@@ -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;
}
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment