summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-10-13 20:30:12 +0000
committerUlrich Drepper <drepper@redhat.com>2006-10-13 20:30:12 +0000
commitdbc3d56b704c7858de411b59688efe7860dfe580 (patch)
tree56179f7edcb449b1a88bd1d5015404a2adabd448
parent75aaf98ff8bad6359d19727c308af0f81486d924 (diff)
downloadglibc-dbc3d56b704c7858de411b59688efe7860dfe580.tar.gz
glibc-dbc3d56b704c7858de411b59688efe7860dfe580.tar.xz
glibc-dbc3d56b704c7858de411b59688efe7860dfe580.zip
* malloc/malloc.c (do_check_malloc_state): Only require for empty
	bins for large sizes in main arena.
-rw-r--r--ChangeLog3
-rw-r--r--malloc/malloc.c13
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 86f54b4248..941d2f4223 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-10-13  Ulrich Drepper  <drepper@redhat.com>
 
+	* malloc/malloc.c (do_check_malloc_state): Only require for empty
+	bins for large sizes in main arena.
+
 	* libio/stdio.h: Add more __wur attributes.
 
 	* elf/dl-minimal.c (realloc): Optimize last patch.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index c3855290f7..e4b693c342 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2741,8 +2741,19 @@ static void do_check_malloc_state(mstate av)
   for (i = 0; i < NFASTBINS; ++i) {
     p = av->fastbins[i];
 
+    /* The following test can only be performed for the main arena.
+       While mallopt calls malloc_consolidate to get rid of all fast
+       bins (especially those larger than the new maximum) this does
+       only happen for the main arena.  Trying to do this for any
+       other arena would mean those arenas have to be locked and
+       malloc_consolidate be called for them.  This is excessive.  And
+       even if this is acceptable to somebody it still cannot solve
+       the problem completely since if the arena is locked a
+       concurrent malloc call might create a new arena which then
+       could use the newly invalid fast bins.  */
+
     /* all bins past max_fast are empty */
-    if (i > max_fast_bin)
+    if (av == &main_arena && i > max_fast_bin)
       assert(p == 0);
 
     while (p != 0) {