trace_ptr->path_mmap = 0;
trace_ptr->path_munmap = 0;
trace_ptr->path_m_f_realloc = 0;
+ trace_ptr->path_hook = 0;
+ trace_ptr->path_unsorted_add = 0;
+ trace_ptr->path_unsorted_remove = 0;
+ trace_ptr->path_unsorted_empty = 0;
+ trace_ptr->path_fastbin_add = 0;
+ trace_ptr->path_fastbin_remove = 0;
+ trace_ptr->path_malloc_consolidate = 0;
trace_ptr->path = 0;
trace_ptr->ptr1 = ptr1;
trace_ptr->ptr2 = 0;
}
}
#endif
+ __MTB_TRACE_PATH(fastbin_remove);
void *p = chunk2mem (victim);
alloc_perturb (p, bytes);
return p;
int iters = 0;
while ((victim = unsorted_chunks (av)->bk) != unsorted_chunks (av))
{
+ __MTB_TRACE_PATH(unsorted_remove);
bck = victim->bk;
if (__builtin_expect (victim->size <= 2 * SIZE_SZ, 0)
|| __builtin_expect (victim->size > av->system_mem, 0))
(unsigned long) (size) > (unsigned long) (nb + MINSIZE))
{
/* split and reattach remainder */
+ __MTB_TRACE_PATH(unsorted_add);
remainder_size = size - nb;
remainder = chunk_at_offset (victim, nb);
unsorted_chunks (av)->bk = unsorted_chunks (av)->fd = remainder;
if (++iters >= MAX_ITERS)
break;
}
+ if (unsorted_chunks (av)->bk == unsorted_chunks (av))
+ __MTB_TRACE_PATH(unsorted_empty);
+
#if USE_TCACHE
/* If all the small chunks we found ended up cached, return one now. */
remainder = chunk_at_offset (victim, nb);
/* We cannot assume the unsorted list is empty and therefore
have to perform a complete insert here. */
+ __MTB_TRACE_PATH(unsorted_add);
bck = unsorted_chunks (av);
fwd = bck->fd;
if (__glibc_unlikely (fwd->bk != bck))
/* We cannot assume the unsorted list is empty and therefore
have to perform a complete insert here. */
+ __MTB_TRACE_PATH(unsorted_add);
bck = unsorted_chunks (av);
fwd = bck->fd;
if (__glibc_unlikely (fwd->bk != bck))
fb = &fastbin (av, idx);
/* Atomically link P to its fastbin: P->FD = *FB; *FB = P; */
+ __MTB_TRACE_PATH(fastbin_add);
mchunkptr old = *fb, old2;
unsigned int old_idx = ~0u;
do
been given one chance to be used in malloc.
*/
+ __MTB_TRACE_PATH(unsorted_add);
bck = unsorted_chunks(av);
fwd = bck->fd;
if (__glibc_unlikely (fwd->bk != bck))
mchunkptr bck;
mchunkptr fwd;
+ __MTB_TRACE_PATH(malloc_consolidate);
+
/*
If max_fast is 0, we know that av hasn't
yet been initialized, in which case do so below
check_inuse_chunk(av, p);
nextp = p->fd;
+ __MTB_TRACE_PATH(fastbin_remove);
/* Slightly streamlined version of consolidation code in free() */
size = p->size & ~(PREV_INUSE|NON_MAIN_ARENA);
nextchunk = chunk_at_offset(p, size);
} else
clear_inuse_bit_at_offset(nextchunk, 0);
+ __MTB_TRACE_PATH(unsorted_add);
first_unsorted = unsorted_bin->fd;
unsorted_bin->fd = p;
first_unsorted->bk = p;
uint32_t path_munmap:1; /* munmap was called */
uint32_t path_m_f_realloc:1; /* realloc became malloc/free (i.e. next few records) */
uint32_t path_hook:1; /* A hook was used to complete the request */
- uint32_t path:16; /* remaining bits */
+ uint32_t path_unsorted_add:1; /* something was added to the unsorted bin */
+ uint32_t path_unsorted_remove:1; /* something was removed from the unsorted bin */
+ uint32_t path_unsorted_empty:1; /* the unsorted bin was emptied */
+ uint32_t path_fastbin_add:1; /* something was added to a fastbin */
+ uint32_t path_fastbin_remove:1; /* something was removed from a fastbin */
+ uint32_t path_malloc_consolidate:1; /* something was removed from a fastbin */
+ uint32_t path:10; /* remaining bits */
/* FREE - pointer to allocation to free.
REALLOC - pointer to original allocation.
default:
/* Consider 'memalign' to be the largest API word we want to align
on so make the name 8 chars wide at a minimum. */
- printf ("%08x %8s %c%c%c%c%c%c%c%c %016llx %016llx %016llx %016llx %016llx\n",
+ printf ("%08x %8s %c%c%c%c%c%c%c%c%c%c%c%c%c%c %016llx %016llx %016llx %016llx %016llx\n",
t->thread,
t->type == __MTB_TYPE_MAGIC ? "magic" : typenames[t->type],
t->path_thread_cache ? 'T' : '-',
t->path_munmap ? 'U' : '-',
t->path_m_f_realloc ? 'R' : '-',
t->path_hook ? 'H' : '-',
+ t->path_unsorted_add ? 'U' : '-',
+ t->path_unsorted_remove ? 'u' : '-',
+ t->path_unsorted_empty ? 'E' : '-',
+ t->path_fastbin_add ? 'F' : '-',
+ t->path_fastbin_remove ? 'f' : '-',
+ t->path_malloc_consolidate ? 'C' : '-',
(long long unsigned int) (size_t) t->ptr1,
(long long unsigned int) t->size,
(long long unsigned int) (size_t) t->ptr2,