[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r2231 - in /fsf/trunk/libc: ChangeLog malloc/arena.c malloc/hooks.c malloc/malloc.c
- To: commits@xxxxxxxxxx
- Subject: [commits] r2231 - in /fsf/trunk/libc: ChangeLog malloc/arena.c malloc/hooks.c malloc/malloc.c
- From: eglibc@xxxxxxxxxx
- Date: Mon, 14 May 2007 07:02:46 -0000
Author: eglibc
Date: Mon May 14 00:02:43 2007
New Revision: 2231
Log:
Import glibc-mainline for 2007-05-14
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/malloc/arena.c
fsf/trunk/libc/malloc/hooks.c
fsf/trunk/libc/malloc/malloc.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Mon May 14 00:02:43 2007
@@ -1,3 +1,10 @@
+2007-05-13 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * malloc/malloc.c [MALLOC_DEBUG]: Keep track of current maximum
+ number of mmaps. n_mmaps_max is the target.
+ * malloc/hooks.c: Likewise.
+ * malloc/arena.c: Likewise.
+
2007-05-12 Andreas Jaeger <aj@xxxxxxx>
* sysdeps/unix/sysv/linux/tst-getcpu.c: Include <unistd.h> for
Modified: fsf/trunk/libc/malloc/arena.c
==============================================================================
--- fsf/trunk/libc/malloc/arena.c (original)
+++ fsf/trunk/libc/malloc/arena.c Mon May 14 00:02:43 2007
@@ -370,6 +370,9 @@
mp_.top_pad = DEFAULT_TOP_PAD;
#endif
mp_.n_mmaps_max = DEFAULT_MMAP_MAX;
+#if MALLOC_DEBUG
+ mp_.n_mmaps_cmax = DEFAULT_MMAP_MAX;
+#endif
mp_.mmap_threshold = DEFAULT_MMAP_THRESHOLD;
mp_.trim_threshold = DEFAULT_TRIM_THRESHOLD;
mp_.pagesize = malloc_getpagesize;
Modified: fsf/trunk/libc/malloc/hooks.c
==============================================================================
--- fsf/trunk/libc/malloc/hooks.c (original)
+++ fsf/trunk/libc/malloc/hooks.c Mon May 14 00:02:43 2007
@@ -1,5 +1,5 @@
/* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+ Copyright (C) 2001-2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@xxxxxxxxx>, 2001.
@@ -507,6 +507,9 @@
unsigned long trim_threshold;
unsigned long top_pad;
unsigned int n_mmaps_max;
+#if MALLOC_DEBUG
+ unsigned int n_mmaps_cmax;
+#endif
unsigned long mmap_threshold;
int check_action;
unsigned long max_sbrked_mem;
@@ -550,6 +553,9 @@
ms->trim_threshold = mp_.trim_threshold;
ms->top_pad = mp_.top_pad;
ms->n_mmaps_max = mp_.n_mmaps_max;
+#if MALLOC_DEBUG
+ ms->n_mmaps_cmax = mp_.n_mmaps_cmax;
+#endif
ms->mmap_threshold = mp_.mmap_threshold;
ms->check_action = check_action;
ms->max_sbrked_mem = main_arena.max_system_mem;
@@ -621,6 +627,9 @@
mp_.trim_threshold = ms->trim_threshold;
mp_.top_pad = ms->top_pad;
mp_.n_mmaps_max = ms->n_mmaps_max;
+#if MALLOC_DEBUG
+ mp_.n_mmaps_cmax = ms->n_mmaps_cmax;
+#endif
mp_.mmap_threshold = ms->mmap_threshold;
check_action = ms->check_action;
main_arena.max_system_mem = ms->max_sbrked_mem;
Modified: fsf/trunk/libc/malloc/malloc.c
==============================================================================
--- fsf/trunk/libc/malloc/malloc.c (original)
+++ fsf/trunk/libc/malloc/malloc.c Mon May 14 00:02:43 2007
@@ -2343,6 +2343,9 @@
/* Memory map support */
int n_mmaps;
int n_mmaps_max;
+#if MALLOC_DEBUG
+ int n_mmaps_cmax;
+#endif
int max_n_mmaps;
/* the mmap_threshold is dynamic, until the user sets
it manually, at which point we need to disable any
@@ -2858,7 +2861,8 @@
assert(total <= (unsigned long)(mp_.max_total_mem));
assert(mp_.n_mmaps >= 0);
#endif
- assert(mp_.n_mmaps <= mp_.n_mmaps_max);
+ assert(mp_.n_mmaps <= mp_.n_mmaps_cmax);
+ assert(mp_.n_mmaps_max <= mp_.n_mmaps_cmax);
assert(mp_.n_mmaps <= mp_.max_n_mmaps);
assert((unsigned long)(av->system_mem) <=
@@ -3456,6 +3460,13 @@
}
mp_.n_mmaps--;
+#if MALLOC_DEBUG
+ if (mp_.n_mmaps_cmax > mp_.n_mmaps_max)
+ {
+ assert (mp_.n_mmaps_cmax == mp_.n_mmaps + 1);
+ mp_.n_mmaps_cmax = mp_.n_mmaps;
+ }
+#endif
mp_.mmapped_mem -= total_size;
int ret __attribute__ ((unused)) = munmap((char *)block, total_size);
@@ -5371,6 +5382,9 @@
mp_.n_mmaps_max = 0;
mem = _int_malloc(av, size);
mp_.n_mmaps_max = mmx; /* reset mmap */
+#if MALLOC_DEBUG
+ mp_.n_mmaps_cmax = mmx;
+#endif
if (mem == 0)
return 0;
@@ -5696,8 +5710,17 @@
res = 0;
else
#endif
- mp_.n_mmaps_max = value;
- mp_.no_dyn_threshold = 1;
+ {
+#if MALLOC_DEBUG
+ if (mp_.n_mmaps <= value)
+ mp_.n_mmaps_cmax = value;
+ else
+ mp_.n_mmaps_cmax = mp_.n_mmaps;
+#endif
+
+ mp_.n_mmaps_max = value;
+ mp_.no_dyn_threshold = 1;
+ }
break;
case M_CHECK_ACTION: