MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / init_top

Method init_top

libCacheSim/dataStructure/sparsepp/spp_dlalloc.h:2391–2404  ·  view source on GitHub ↗

Initialize top chunk and its size

Source from the content-addressed store, hash-verified

2389
2390// Initialize top chunk and its size
2391void malloc_state::init_top(mchunkptr p, size_t psize)
2392{
2393 // Ensure alignment
2394 size_t offset = align_offset(chunk2mem(p));
2395 p = (mchunkptr)((char*)p + offset);
2396 psize -= offset;
2397
2398 _top = p;
2399 _topsize = psize;
2400 p->_head = psize | PINUSE_BIT;
2401 // set size of fake trailing chunk holding overhead space only once
2402 p->chunk_plus_offset(psize)->_head = top_foot_size();
2403 _trim_check = mparams._trim_threshold; // reset on each update
2404}
2405
2406// Initialize bins for a new mstate that is otherwise zeroed out
2407void malloc_state::init_bins()

Callers

nothing calls this directly

Calls 4

align_offsetFunction · 0.85
chunk2memFunction · 0.85
top_foot_sizeFunction · 0.85
chunk_plus_offsetMethod · 0.80

Tested by

no test coverage detected