/* Caller must ensure that we know tc_idx is valid and there's room
for more chunks. */
static void
tcache_put (mchunkptr chunk, size_t tc_idx)
{
tcache_entry *e = (tcache_entry *) chunk2mem (chunk);
assert (tc_idx < TCACHE_MAX_BINS);
e->next = tcache->entries[tc_idx];
tcache->entries[tc_idx] = e;
++(tcache->counts[tc_idx]);
}
tcache에 freed 청크를 넣는 작업을 하는 함수이다
- 포인터 e에 chunk주소 저장
- tc_idx가 TCACHE_MAX_BINS보다 작은지 검사
- 엔트리에 저장된 값을 포인터 e->next에 저장
- 엔트리에 e 저장
- count를 1증가
'Heap analysis > glibc 2.26' 카테고리의 다른 글
(glibc 2.26) _int_free (0) | 2022.05.02 |
---|---|
(glibc 2.26) _int_malloc (0) | 2022.05.01 |
(glibc 2.26) tcache_get (0) | 2022.05.01 |
(glibc 2.26) tcache_init (0) | 2022.05.01 |
(glibc 2.26) malloc (0) | 2022.05.01 |