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

Function init_user_mstate

dlmalloc/dlmalloc.c:4716–4734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4714#if MSPACES
4715
4716static mstate init_user_mstate(char* tbase, size_t tsize) {
4717 size_t msize = pad_request(sizeof(struct malloc_state));
4718 mchunkptr mn;
4719 mchunkptr msp = align_as_chunk(tbase);
4720 mstate m = (mstate)(chunk2mem(msp));
4721 memset(m, 0, msize);
4722 INITIAL_LOCK(&m->mutex);
4723 msp->head = (msize|PINUSE_BIT|CINUSE_BIT);
4724 m->seg.base = m->least_addr = tbase;
4725 m->seg.size = m->footprint = m->max_footprint = tsize;
4726 m->magic = mparams.magic;
4727 m->mflags = mparams.default_mflags;
4728 disable_contiguous(m);
4729 init_bins(m);
4730 mn = next_chunk(mem2chunk(m));
4731 init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE);
4732 check_top_chunk(m, m->top);
4733 return m;
4734}
4735
4736mspace create_mspace(size_t capacity, int locked) {
4737 mstate m = 0;

Callers 2

create_mspaceFunction · 0.85
create_mspace_with_baseFunction · 0.85

Calls 2

init_binsFunction · 0.85
init_topFunction · 0.85

Tested by

no test coverage detected