MCPcopy Index your code
hub / github.com/dcodeIO/webassembly / init_top

Function init_top

lib/dlmalloc/malloc.c:3891–3903  ·  view source on GitHub ↗

Initialize top chunk and its size */

Source from the content-addressed store, hash-verified

3889
3890/* Initialize top chunk and its size */
3891static void init_top(mstate m, mchunkptr p, size_t psize) {
3892 /* Ensure alignment */
3893 size_t offset = align_offset(chunk2mem(p));
3894 p = (mchunkptr)((char*)p + offset);
3895 psize -= offset;
3896
3897 m->top = p;
3898 m->topsize = psize;
3899 p->head = psize | PINUSE_BIT;
3900 /* set size of fake trailing chunk holding overhead space only once */
3901 chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE;
3902 m->trim_check = mparams.trim_threshold; /* reset on each update */
3903}
3904
3905/* Initialize bins for a new mstate that is otherwise zeroed out */
3906static 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