전체 코드는 아래 더보기
더보기
static void
tcache_init(void)
{
mstate ar_ptr;
void *victim = 0;
const size_t bytes = sizeof (tcache_perthread_struct);
if (tcache_shutting_down)
return;
arena_get (ar_ptr, bytes);
victim = _int_malloc (ar_ptr, bytes);
if (!victim && ar_ptr != NULL)
{
ar_ptr = arena_get_retry (ar_ptr, bytes);
victim = _int_malloc (ar_ptr, bytes);
}
if (ar_ptr != NULL)
__libc_lock_unlock (ar_ptr->mutex);
/* In a low memory situation, we may not be able to allocate memory
- in which case, we just keep trying later. However, we
typically do this very early, so either there is sufficient
memory, or there isn't enough memory to do non-trivial
allocations anyway. */
if (victim)
{
tcache = (tcache_perthread_struct *) victim;
memset (tcache, 0, sizeof (tcache_perthread_struct));
}
}
glibc 2.26버전과 동일하다
'Heap analysis > glibc 2.29' 카테고리의 다른 글
(glibc 2.29) tcache_put (0) | 2022.05.19 |
---|---|
(glibc 2.29) tcache_get (0) | 2022.05.19 |
(glibc 2.29) _int_free (0) | 2022.05.15 |
(glibc 2.29) free (0) | 2022.05.15 |
(glibc 2.29) _int_malloc (0) | 2022.05.14 |