diff options
| author | Jakub Jelinek <jakub@redhat.com> | 2009-02-18 15:49:44 +0000 |
|---|---|---|
| committer | Jakub Jelinek <jakub@redhat.com> | 2009-02-18 15:49:44 +0000 |
| commit | cf22c5c9b3a4a6cc81a269d49d2324b5df084d74 (patch) | |
| tree | ca7e374c348baf4e6510329f3f271eca4eb5419f /malloc/memusage.c | |
| parent | 73c5dd45bc405428148ee740cac61a1279fe57d4 (diff) | |
| download | glibc-cf22c5c9b3a4a6cc81a269d49d2324b5df084d74.tar.xz glibc-cf22c5c9b3a4a6cc81a269d49d2324b5df084d74.zip | |
Updated to fedora-glibc-20090218T1534
Diffstat (limited to 'malloc/memusage.c')
| -rw-r--r-- | malloc/memusage.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/malloc/memusage.c b/malloc/memusage.c index d11e9e6ed5..fcd58dc684 100644 --- a/malloc/memusage.c +++ b/malloc/memusage.c @@ -1,5 +1,5 @@ /* Profile heap and stack memory usage of running program. - Copyright (C) 1998-2002, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004-2006, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -18,6 +18,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <assert.h> #include <atomic.h> #include <dlfcn.h> #include <errno.h> @@ -92,7 +93,7 @@ static __thread uintptr_t start_sp; #define peak_stack peak_use[1] #define peak_total peak_use[2] -#define DEFAULT_BUFFER_SIZE 1024 +#define DEFAULT_BUFFER_SIZE 32768 static size_t buffer_size; static int fd = -1; @@ -168,10 +169,11 @@ update_data (struct header *result, size_t len, size_t old_len) this fails because of another thread increasing the counter it does not matter since that thread will take care of the correction. */ - unsigned int reset = idx - 2 * buffer_size; - catomic_compare_and_exchange_val_acq (&buffer_size, reset, idx); + uatomic32_t reset = idx % (2 * buffer_size); + catomic_compare_and_exchange_val_acq (&buffer_cnt, reset, idx); idx = reset; } + assert (idx < 2 * DEFAULT_BUFFER_SIZE); buffer[idx].heap = current_heap; buffer[idx].stack = current_stack; |
