Skip to content

Commit

Permalink
* malloc/malloc.c (do_check_malloc_state): Only require for empty
Browse files Browse the repository at this point in the history
	bins for large sizes in main arena.
  • Loading branch information
Ulrich Drepper committed Oct 13, 2006
1 parent 75aaf98 commit dbc3d56
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
13 changes: 12 additions & 1 deletion malloc/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit dbc3d56

Please sign in to comment.