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

Function init_user_mstate

lib/dlmalloc/malloc.c:5394–5415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5392#if MSPACES
5393
5394static mstate init_user_mstate(char* tbase, size_t tsize) {
5395 size_t msize = pad_request(sizeof(struct malloc_state));
5396 mchunkptr mn;
5397 mchunkptr msp = align_as_chunk(tbase);
5398 mstate m = (mstate)(chunk2mem(msp));
5399 memset(m, 0, msize);
5400 (void)INITIAL_LOCK(&m->mutex);
5401 msp->head = (msize|INUSE_BITS);
5402 m->seg.base = m->least_addr = tbase;
5403 m->seg.size = m->footprint = m->max_footprint = tsize;
5404 m->magic = mparams.magic;
5405 m->release_checks = MAX_RELEASE_CHECK_RATE;
5406 m->mflags = mparams.default_mflags;
5407 m->extp = 0;
5408 m->exts = 0;
5409 disable_contiguous(m);
5410 init_bins(m);
5411 mn = next_chunk(mem2chunk(m));
5412 init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE);
5413 check_top_chunk(m, m->top);
5414 return m;
5415}
5416
5417mspace create_mspace(size_t capacity, int locked) {
5418 mstate m = 0;

Callers 2

create_mspaceFunction · 0.85
create_mspace_with_baseFunction · 0.85

Calls 3

memsetFunction · 0.85
init_binsFunction · 0.85
init_topFunction · 0.85

Tested by

no test coverage detected