MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / init_top

Function init_top

system/lib/dlmalloc.c:3977–3989  ·  view source on GitHub ↗

Initialize top chunk and its size */

Source from the content-addressed store, hash-verified

3975
3976/* Initialize top chunk and its size */
3977static void init_top(mstate m, mchunkptr p, size_t psize) {
3978 /* Ensure alignment */
3979 size_t offset = align_offset(chunk2mem(p));
3980 p = (mchunkptr)((char*)p + offset);
3981 psize -= offset;
3982
3983 m->top = p;
3984 m->topsize = psize;
3985 p->head = psize | PINUSE_BIT;
3986 /* set size of fake trailing chunk holding overhead space only once */
3987 chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE;
3988 m->trim_check = mparams.trim_threshold; /* reset on each update */
3989}
3990
3991/* Initialize bins for a new mstate that is otherwise zeroed out */
3992static void init_bins(mstate m) {

Callers 4

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

Calls

no outgoing calls

Tested by

no test coverage detected