MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / init_top

Function init_top

dlmalloc/dlmalloc.c:3269–3283  ·  view source on GitHub ↗

Initialize top chunk and its size */

Source from the content-addressed store, hash-verified

3267
3268/* Initialize top chunk and its size */
3269static void init_top(mstate m, mchunkptr p, size_t psize) {
3270 /* Ensure alignment */
3271 size_t offset = align_offset(chunk2mem(p));
3272 p = (mchunkptr)((char*)p + offset);
3273 psize -= offset;
3274
3275 m->top = p;
3276 m->topsize = psize;
3277 p->head = psize | PINUSE_BIT;
3278 /* set size of fake trailing chunk holding overhead space only once */
3279 chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE;
3280 m->trim_check = (psize >> 2) + (psize >> 1); /* reset on each update */
3281 if (m->trim_check > mparams.trim_threshold)
3282 m->trim_check = mparams.trim_threshold;
3283}
3284
3285/* Initialize bins for a new mstate that is otherwise zeroed out */
3286static void init_bins(mstate m) {

Callers 5

add_segmentFunction · 0.85
sys_allocFunction · 0.85
sys_trimFunction · 0.85
internal_reallocFunction · 0.85
init_user_mstateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected