aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-11-30 18:11:26 +0000
committerNick Mathewson <nickm@torproject.org>2007-11-30 18:11:26 +0000
commitac82d81538908636711b3b1824af682f47d4f64f (patch)
tree8f9bc8357b8f06eb18b574e17cbb3b43f6fd77e3 /src/common/util.c
parent188cb920d01349b256a49bd96b7e26c09c2d54af (diff)
downloadtor-ac82d81538908636711b3b1824af682f47d4f64f.tar
tor-ac82d81538908636711b3b1824af682f47d4f64f.tar.gz
r16874@catbus: nickm | 2007-11-30 13:11:09 -0500
When using dmalloc, dump the top ten memory consumers to the _DMALLOC_ logfile when we get a SIGUSR1. Hint: it is not what you would think. svn:r12613
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 87f6aa5f1..03670c503 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -76,8 +76,10 @@ const char util_c_id[] = "$Id$";
* Memory management
* ===== */
#ifdef USE_DMALLOC
+ #undef strndup
#include <dmalloc.h>
#define DMALLOC_FN_ARGS , file, line
+ #define dmalloc_strdup(file, line, string, xalloc_b) dmalloc_strndup(file, line, (string), -1, xalloc_b)
#else
#define dmalloc_strdup(file, line, string, xalloc_b) strdup(string)
@@ -228,6 +230,10 @@ tor_log_mallinfo(int severity)
#else
(void)severity;
#endif
+#ifdef USE_DMALLOC
+ dmalloc_log_stats();
+ // too wordy dmalloc_log_unfreed();
+#endif
}
/* =====