mstate ar_ptr; mchunkptr p; /* chunk corresponding to mem */ 필요한 변수 선언 void (*hook) (void *, const void *) = atomic_forced_read (__free_hook); if (__builtin_expect (hook != NULL, 0)) { (*hook)(mem, RETURN_ADDRESS (0)); return; } 이전 글과 마찬가지로 더 공부한 뒤 나중에 설명하겠습니다. if (mem == 0) /* free(0) has no effect */ return; NULL 메모리를 free하는 것은 효과가 없다, p = mem2chunk (mem); if (chunk_is_mmapped (p)) /* release ..
mstate ar_ptr; void *victim; 필요한 변수를 선언한다. void *(*hook) (size_t, const void *) = atomic_forced_read (__malloc_hook); if (__builtin_expect (hook != NULL, 0)) return (*hook)(bytes, RETURN_ADDRESS (0)); calloc때와 마찬가지로 더 공부한 뒤에 따로 설명하겠습니다, ㅠ.ㅠ #if USE_TCACHE /* int_free also calls request2size, be careful to not pad twice. */ size_t tbytes; checked_request2size (bytes, tbytes); size_t tc_idx = csiz..
mstate av; mchunkptr oldtop, p; INTERNAL_SIZE_T bytes, sz, csz, oldtopsize; void *mem; unsigned long clearsize; unsigned long nclears; INTERNAL_SIZE_T *d; 사용될 변수들을 선언해놓는다. /* size_t is unsigned so the behavior on overflow is defined. */ bytes = n * elem_size; #define HALF_INTERNAL_SIZE_T \ (((INTERNAL_SIZE_T) 1) = HALF_INTERNAL_SIZE_T, 0)) { if (elem_size != 0 && bytes / elem_size != n) { __set_..
/* We overlay this structure on the user-data portion of a chunk when the chunk is stored in the per-thread cache. */ typedef struct tcache_entry { struct tcache_entry *next; } tcache_entry; tcache_entry 구조체의 모습이다. next라는 이름의 포인터밖에 없다. /* There is one of these for each thread, which contains the per-thread cache (hence "tcache_perthread_struct"). Keeping overall size low is mildly important. Not..