summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-08-19 22:34:27 +0000
committerUlrich Drepper <drepper@redhat.com>2006-08-19 22:34:27 +0000
commit72320021f73568672d27ac090b1c0594c6fa0296 (patch)
tree056420f4e791f2946ea84b2efaf8f6ada7abe97c
parented3691bab2a633991d2b30f4367221a9d804fedc (diff)
downloadglibc-72320021f73568672d27ac090b1c0594c6fa0296.tar.gz
* malloc/malloc.c (_int_malloc): Limit number of unsorted blocks
to sort in each call.
-rw-r--r--ChangeLog3
-rw-r--r--malloc/malloc.c8
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9dd545dc7e..4647b9e483 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2006-08-19 Ulrich Drepper <drepper@redhat.com>
+ * malloc/malloc.c (_int_malloc): Limit number of unsorted blocks
+ to sort in each call.
+
* nis/nss_nis/nis-service.c (internal_nis_getservent_r): . If map
is empty simply return and use next service.
* nis/nss_nis/nis-rpc.c (internal_nis_getrpcent_r): Likewise.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 890d3669e2..3f4ddcd7f7 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4055,6 +4055,8 @@ _int_malloc(mstate av, size_t bytes)
for(;;) {
+ int iters = 0;
+ bool any_larger = false;
while ( (victim = unsorted_chunks(av)->bk) != unsorted_chunks(av)) {
bck = victim->bk;
if (__builtin_expect (victim->size <= 2 * SIZE_SZ, 0)
@@ -4145,6 +4147,12 @@ _int_malloc(mstate av, size_t bytes)
}
}
+ if (size >= nb)
+ any_larger = true;
+#define MAX_ITERS 10000
+ if (++iters == MAX_ITERS)
+ break;
+
mark_bin(av, victim_index);
victim->bk = bck;
victim->fd = fwd;