Commit f0932b7a authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

More hacking on dlmalloc. Addresses #1032, #1328, #1343.

git-svn-id: file:///svn/toku/tokudb.1032b+1343@8476 c7de825b-a66e-492c-adef-691d508d4ae1
parent d7fa1f80
...@@ -286,7 +286,7 @@ int toku_set_trace_file (char *fname) __attribute__((__visibility__("default"))) ...@@ -286,7 +286,7 @@ int toku_set_trace_file (char *fname) __attribute__((__visibility__("default")))
int toku_close_trace_file (void) __attribute__((__visibility__("default"))); int toku_close_trace_file (void) __attribute__((__visibility__("default")));
int db_env_set_func_malloc (void *(*)(size_t)) __attribute__((__visibility__("default"))); int db_env_set_func_malloc (void *(*)(size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_realloc (void *(*)(void*, size_t)) __attribute__((__visibility__("default"))); int db_env_set_func_realloc (void *(*)(void*, size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_free (void *(*)(void*)) __attribute__((__visibility__("default"))); int db_env_set_func_free (void (*)(void*)) __attribute__((__visibility__("default")));
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif
......
...@@ -302,7 +302,7 @@ int toku_set_trace_file (char *fname) __attribute__((__visibility__("default"))) ...@@ -302,7 +302,7 @@ int toku_set_trace_file (char *fname) __attribute__((__visibility__("default")))
int toku_close_trace_file (void) __attribute__((__visibility__("default"))); int toku_close_trace_file (void) __attribute__((__visibility__("default")));
int db_env_set_func_malloc (void *(*)(size_t)) __attribute__((__visibility__("default"))); int db_env_set_func_malloc (void *(*)(size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_realloc (void *(*)(void*, size_t)) __attribute__((__visibility__("default"))); int db_env_set_func_realloc (void *(*)(void*, size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_free (void *(*)(void*)) __attribute__((__visibility__("default"))); int db_env_set_func_free (void (*)(void*)) __attribute__((__visibility__("default")));
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif
......
...@@ -308,7 +308,7 @@ int toku_set_trace_file (char *fname) __attribute__((__visibility__("default"))) ...@@ -308,7 +308,7 @@ int toku_set_trace_file (char *fname) __attribute__((__visibility__("default")))
int toku_close_trace_file (void) __attribute__((__visibility__("default"))); int toku_close_trace_file (void) __attribute__((__visibility__("default")));
int db_env_set_func_malloc (void *(*)(size_t)) __attribute__((__visibility__("default"))); int db_env_set_func_malloc (void *(*)(size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_realloc (void *(*)(void*, size_t)) __attribute__((__visibility__("default"))); int db_env_set_func_realloc (void *(*)(void*, size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_free (void *(*)(void*)) __attribute__((__visibility__("default"))); int db_env_set_func_free (void (*)(void*)) __attribute__((__visibility__("default")));
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif
......
...@@ -308,7 +308,7 @@ int toku_set_trace_file (char *fname) __attribute__((__visibility__("default"))) ...@@ -308,7 +308,7 @@ int toku_set_trace_file (char *fname) __attribute__((__visibility__("default")))
int toku_close_trace_file (void) __attribute__((__visibility__("default"))); int toku_close_trace_file (void) __attribute__((__visibility__("default")));
int db_env_set_func_malloc (void *(*)(size_t)) __attribute__((__visibility__("default"))); int db_env_set_func_malloc (void *(*)(size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_realloc (void *(*)(void*, size_t)) __attribute__((__visibility__("default"))); int db_env_set_func_realloc (void *(*)(void*, size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_free (void *(*)(void*)) __attribute__((__visibility__("default"))); int db_env_set_func_free (void (*)(void*)) __attribute__((__visibility__("default")));
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif
......
...@@ -313,7 +313,7 @@ int toku_set_trace_file (char *fname) __attribute__((__visibility__("default"))) ...@@ -313,7 +313,7 @@ int toku_set_trace_file (char *fname) __attribute__((__visibility__("default")))
int toku_close_trace_file (void) __attribute__((__visibility__("default"))); int toku_close_trace_file (void) __attribute__((__visibility__("default")));
int db_env_set_func_malloc (void *(*)(size_t)) __attribute__((__visibility__("default"))); int db_env_set_func_malloc (void *(*)(size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_realloc (void *(*)(void*, size_t)) __attribute__((__visibility__("default"))); int db_env_set_func_realloc (void *(*)(void*, size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_free (void *(*)(void*)) __attribute__((__visibility__("default"))); int db_env_set_func_free (void (*)(void*)) __attribute__((__visibility__("default")));
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif
......
...@@ -356,7 +356,7 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__un ...@@ -356,7 +356,7 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__un
printf("int toku_close_trace_file (void) %s;\n", VISIBLE); printf("int toku_close_trace_file (void) %s;\n", VISIBLE);
printf("int db_env_set_func_malloc (void *(*)(size_t)) %s;\n", VISIBLE); printf("int db_env_set_func_malloc (void *(*)(size_t)) %s;\n", VISIBLE);
printf("int db_env_set_func_realloc (void *(*)(void*, size_t)) %s;\n", VISIBLE); printf("int db_env_set_func_realloc (void *(*)(void*, size_t)) %s;\n", VISIBLE);
printf("int db_env_set_func_free (void *(*)(void*)) %s;\n", VISIBLE); printf("int db_env_set_func_free (void (*)(void*)) %s;\n", VISIBLE);
printf("#if defined(__cplusplus)\n}\n#endif\n"); printf("#if defined(__cplusplus)\n}\n#endif\n");
printf("#endif\n"); printf("#endif\n");
return 0; return 0;
......
...@@ -306,6 +306,9 @@ int log_compare (const DB_LSN*, const DB_LSN *) __attribute__((__visibility__("d ...@@ -306,6 +306,9 @@ int log_compare (const DB_LSN*, const DB_LSN *) __attribute__((__visibility__("d
int db_env_set_func_fsync (int (*)(int)) __attribute__((__visibility__("default"))); int db_env_set_func_fsync (int (*)(int)) __attribute__((__visibility__("default")));
int toku_set_trace_file (char *fname) __attribute__((__visibility__("default"))); int toku_set_trace_file (char *fname) __attribute__((__visibility__("default")));
int toku_close_trace_file (void) __attribute__((__visibility__("default"))); int toku_close_trace_file (void) __attribute__((__visibility__("default")));
int db_env_set_func_malloc (void *(*)(size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_realloc (void *(*)(void*, size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_free (void (*)(void*)) __attribute__((__visibility__("default")));
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif
......
...@@ -72,7 +72,10 @@ extern "C" { ...@@ -72,7 +72,10 @@ extern "C" {
// Deprecated functions. // Deprecated functions.
#if !defined(TOKU_ALLOW_DEPRECATED) #if !defined(TOKU_ALLOW_DEPRECATED)
# if defined(__ICL) //Windows Intel Compiler # if defined(__ICL) //Windows Intel Compiler
# pragma deprecated (fstat, getpid, syscall, sysconf, mkdir, strdup, malloc, free) # pragma deprecated (fstat, getpid, syscall, sysconf, mkdir, strdup);
# ifndef DONT_DEPRECATE_MALLOC
# pragma deprecated (malloc, free, realloc)
# endif
# else # else
int fstat() __attribute__((__deprecated__)); int fstat() __attribute__((__deprecated__));
int getpid(void) __attribute__((__deprecated__)); int getpid(void) __attribute__((__deprecated__));
...@@ -85,9 +88,11 @@ int mkdir() __attribute__((__deprecated__)); ...@@ -85,9 +88,11 @@ int mkdir() __attribute__((__deprecated__));
char* strdup(const char *) __attribute__((__deprecated__)); char* strdup(const char *) __attribute__((__deprecated__));
#undef __strdup #undef __strdup
char* __strdup(const char *) __attribute__((__deprecated__)); char* __strdup(const char *) __attribute__((__deprecated__));
#ifndef DONT_DEPRECATE_MALLOC
void *malloc(size_t) __attribute__((__deprecated__)); void *malloc(size_t) __attribute__((__deprecated__));
void free(void*) __attribute__((__deprecated__)); void free(void*) __attribute__((__deprecated__));
void *realloc(void*, size_t) __attribute__((__deprecated__)); void *realloc(void*, size_t) __attribute__((__deprecated__));
#endif
# endif # endif
#endif #endif
......
...@@ -124,6 +124,6 @@ void maybe_preallocate_in_file (int fd, u_int64_t size); ...@@ -124,6 +124,6 @@ void maybe_preallocate_in_file (int fd, u_int64_t size);
int toku_set_func_fsync (int (*fsync_function)(int)); int toku_set_func_fsync (int (*fsync_function)(int));
int toku_set_func_malloc (void *(*)(size_t)); int toku_set_func_malloc (void *(*)(size_t));
int toku_set_func_realloc (void *(*)(void*,size_t)); int toku_set_func_realloc (void *(*)(void*,size_t));
int toku_set_func_free (void *(*)(void*)); int toku_set_func_free (void (*)(void*));
#endif #endif
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
log_compare; log_compare;
db_env_set_func_fsync; db_env_set_func_fsync;
db_env_set_func_malloc; db_env_set_func_malloc;
db_env_set_func_realloc;
db_env_set_func_free; db_env_set_func_free;
toku_get_maxrss; toku_get_maxrss;
...@@ -30,6 +31,10 @@ ...@@ -30,6 +31,10 @@
toku_realloc; toku_realloc;
toku_strdup; toku_strdup;
dlmalloc;
dlrealloc;
dlfree;
local: *; local: *;
}; };
...@@ -3661,6 +3661,6 @@ int db_env_set_func_malloc (void *(*f)(size_t)) { ...@@ -3661,6 +3661,6 @@ int db_env_set_func_malloc (void *(*f)(size_t)) {
int db_env_set_func_realloc (void *(*f)(void*, size_t)) { int db_env_set_func_realloc (void *(*f)(void*, size_t)) {
return toku_set_func_realloc(f); return toku_set_func_realloc(f);
} }
int db_env_set_func_free (void *(*f)(void*)) { int db_env_set_func_free (void (*f)(void*)) {
return toku_set_func_free(f); return toku_set_func_free(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