From 655673f312318a9d95b71ef9f95a59ff36b0a487 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Fri, 20 Sep 2013 11:10:56 -0300 Subject: Add catch-all alloc retry probe. for ChangeLog * malloc/arena.c (arena_get_retry): Add memory_arena_retry probe. * manual/probes.texi: Document it. --- ChangeLog | 3 +++ malloc/arena.c | 1 + manual/probes.texi | 12 ++++++++++++ 3 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5745991..9d3d27a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2013-09-20 Alexandre Oliva + * malloc/arena.c (arena_get_retry): Add memory_arena_retry probe. + * manual/probes.texi: Document it. + * malloc/malloc.c (__libc_malloc): Add memory_malloc_retry probe. (__libc_realloc): Add memory_realloc_retry probe. (__libc_memalign): Add memory_memalign_retry probe. diff --git a/malloc/arena.c b/malloc/arena.c index 89e8b92..9ace186 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -932,6 +932,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena) static mstate arena_get_retry (mstate ar_ptr, size_t bytes) { + LIBC_PROBE (memory_arena_retry, 2, bytes, ar_ptr); if(ar_ptr != &main_arena) { (void)mutex_unlock(&ar_ptr->mutex); ar_ptr = &main_arena; diff --git a/manual/probes.texi b/manual/probes.texi index 50e0fc2..696525d 100644 --- a/manual/probes.texi +++ b/manual/probes.texi @@ -48,6 +48,18 @@ corresponding two-argument functions, so that in all of these probes the user-requested allocation size is in @var{$arg1}. @end deftp +@deftp Probe memory_arena_retry (size_t @var{$arg1}, void *@var{$arg2}) +This probe is triggered within @code{arena_get_retry} (the function +called to select the alternate arena in which to retry an allocation +that failed on the first attempt), before the selection of an alternate +arena. This probe is redundant, but much easier to use when it's not +important to determine which of the various memory allocation functions +is failing to allocate on the first try. Argument @var{$arg1} is the +same as in the function-specific probes, except for extra room for +padding introduced by functions that have to ensure stricter alignment. +Argument @var{$arg2} is the arena in which allocation failed. +@end deftp + @deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2}) This probe is triggered when @code{malloc} allocates and initializes an additional arena (not the main arena), but before the arena is assigned -- cgit v1.1