[or-cvs] [tor/maint-0.2.1] Stop using malloc_usable_size(): valgrind hates it.

Nick Mathewson nickm at seul.org
Sun May 17 06:09:27 UTC 2009


Author: Nick Mathewson <nickm at torproject.org>
Date: Sun, 17 May 2009 01:55:02 -0400
Subject: Stop using malloc_usable_size(): valgrind hates it.
Commit: 11b9c839f0c04c943a1e5f587dafb704e068b1aa

---
 ChangeLog         |    3 +++
 src/common/util.c |    4 +++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b7a4db1..05d5719 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,9 @@ Changes in version 0.2.1.15??? - ????-??-??
       memory right up to the end of a memarea, then realigned the
       memory one step beyond the end.  Fixes a possible cause of bug
       930.
+    - Stop using malloc_usable_size() to use more area than we had
+      actually allocated: it was safe, but made valgrind really
+      unhappy.  Bugfix on 0.2.0.x.
 
 
 Changes in version 0.2.1.14-rc - 2009-04-12
diff --git a/src/common/util.c b/src/common/util.c
index d153df8..13c55b2 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -258,7 +258,9 @@ _tor_malloc_roundup(size_t *sizep DMALLOC_PARAMS)
 #ifdef HAVE_MALLOC_GOOD_SIZE
   *sizep = malloc_good_size(*sizep);
   return _tor_malloc(*sizep DMALLOC_FN_ARGS);
-#elif defined(HAVE_MALLOC_USABLE_SIZE) && !defined(USE_DMALLOC)
+#elif 0 && defined(HAVE_MALLOC_USABLE_SIZE) && !defined(USE_DMALLOC)
+  /* Never use malloc_usable_size(); it makes valgrind really unhappy,
+   * and doesn't win much in terms of usable space where it exists. */
   void *result = _tor_malloc(*sizep DMALLOC_FN_ARGS);
   *sizep = malloc_usable_size(result);
   return result;
-- 
1.5.6.5




More information about the tor-commits mailing list