=== modified file 'compat/xalloc.cc' --- compat/xalloc.cc 2014-03-16 12:44:59 +0000 +++ compat/xalloc.cc 2014-03-17 11:04:57 +0000 @@ -86,9 +86,6 @@ exit(1); } -#if XMALLOC_DEBUG - check_malloc(p, sz * n); -#endif #if XMALLOC_STATISTICS malloc_stat(sz * n); #endif @@ -124,9 +121,6 @@ exit(1); } -#if XMALLOC_DEBUG - check_malloc(p, sz); -#endif #if XMALLOC_STATISTICS malloc_stat(sz); #endif @@ -147,10 +141,6 @@ if (sz < 1) sz = 1; -#if XMALLOC_DEBUG - if (s != NULL) - check_free(s); -#endif PROF_start(realloc); void *p= realloc(s, sz); PROF_stop(realloc); @@ -167,9 +157,6 @@ exit(1); } -#if XMALLOC_DEBUG - check_malloc(p, sz); -#endif #if XMALLOC_STATISTICS malloc_stat(sz); #endif @@ -187,11 +174,6 @@ void *s = const_cast(s_const); PROF_start(free_const); - -#if XMALLOC_DEBUG - check_free(s); -#endif - PROF_start(free); free(s); PROF_stop(free); === modified file 'configure.ac' --- configure.ac 2014-03-16 12:44:59 +0000 +++ configure.ac 2014-03-17 11:04:57 +0000 @@ -449,16 +449,6 @@ dnl all other uses of RUN_IFELSE are wrapped inside CACHE_CHECK which breaks on 2.64 AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(int argc, char **argv) { return 0; } ]])],[],[],[:]) -dnl This is a developer only option.. developers know how to set defines -dnl -dnl AC_ARG_ENABLE(xmalloc-debug, -dnl [ --enable-xmalloc-debug Do some simple malloc debugging], -dnl [ if test "$enableval" = "yes" ; then -dnl AC_MSG_NOTICE([malloc debugging enabled]) -dnl AC_DEFINE(XMALLOC_DEBUG,1,[Define to do simple malloc debugging]) -dnl fi -dnl ]) - AH_TEMPLATE(XMALLOC_STATISTICS,[Define to have malloc statistics]) AC_ARG_ENABLE(xmalloc-statistics, AS_HELP_STRING([--enable-xmalloc-statistics], === modified file 'lib/malloc_trace.cc' --- lib/malloc_trace.cc 2014-03-16 12:44:59 +0000 +++ lib/malloc_trace.cc 2014-03-17 11:04:57 +0000 @@ -74,101 +74,3 @@ #endif -#if XMALLOC_DEBUG -#define DBG_ARRY_SZ (1<<11) -#define DBG_ARRY_BKTS (1<<8) -static void *(*malloc_ptrs)[DBG_ARRY_SZ]; -static int malloc_size[DBG_ARRY_BKTS][DBG_ARRY_SZ]; -static int dbg_initd = 0; - -#define DBG_HASH_BUCKET(ptr) (((((int)ptr)>>4)+(((int)ptr)>>12)+(((int)ptr)>>20))&0xFF) - -static void -check_init(void) -{ - int B = 0, I = 0; - /* calloc the ptrs so that we don't see them when hunting lost memory */ - malloc_ptrs = calloc(DBG_ARRY_BKTS, sizeof(*malloc_ptrs)); - - for (B = 0; B < DBG_ARRY_BKTS; ++B) { - for (I = 0; I < DBG_ARRY_SZ; ++I) { - malloc_ptrs[B][I] = NULL; - malloc_size[B][I] = 0; - } - } - - dbg_initd = 1; -} - -static void -check_free(void *s) -{ - int B, I; - B = DBG_HASH_BUCKET(s); - - for (I = 0; I < DBG_ARRY_SZ; ++I) { - if (malloc_ptrs[B][I] != s) - continue; - - malloc_ptrs[B][I] = NULL; - malloc_size[B][I] = 0; - break; - } - - if (I == DBG_ARRY_SZ) { - static char msg[128]; - snprintf(msg, 128, "xfree: ERROR: s=%p not found!", s); - if (failure_notify) - (*failure_notify) (msg); - else - perror(msg); - } -} - -static void -check_malloc(void *p, size_t sz) -{ - void *P, *Q; - int B, I; - - if (!dbg_initd) - check_init(); - - B = DBG_HASH_BUCKET(p); - - for (I = 0; I < DBG_ARRY_SZ; ++I) { - if (!(P = malloc_ptrs[B][I])) - continue; - - Q = P + malloc_size[B][I]; - - if (P <= p && p < Q) { - static char msg[128]; - snprintf(msg, 128, "xmalloc: ERROR: p=%p falls in P=%p+%d", - p, P, malloc_size[B][I]); - if (failure_notify) - (*failure_notify) (msg); - else - perror(msg); - } - } - - for (I = 0; I < DBG_ARRY_SZ; ++I) { - if (malloc_ptrs[B][I]) - continue; - - malloc_ptrs[B][I] = p; - malloc_size[B][I] = (int) sz; - break; - } - - if (I == DBG_ARRY_SZ) { - if (failure_notify) - (*failure_notify) ("xmalloc: debug out of array space!"); - else - perror("xmalloc: debug out of array space!"); - } -} - -#endif -