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

Function create_mspace

libCacheSim/dataStructure/sparsepp/spp_dlalloc.h:3677–3697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3675}
3676
3677SPP_API mspace create_mspace(size_t capacity, int locked)
3678{
3679 mstate m = 0;
3680 size_t msize;
3681 mparams.ensure_initialization();
3682 msize = pad_request(sizeof(malloc_state));
3683 if (capacity < (size_t) - (msize + top_foot_size() + mparams._page_size))
3684 {
3685 size_t rs = ((capacity == 0) ? mparams._granularity :
3686 (capacity + top_foot_size() + msize));
3687 size_t tsize = mparams.granularity_align(rs);
3688 char* tbase = (char*)(SPP_CALL_MMAP(tsize));
3689 if (tbase != cmfail)
3690 {
3691 m = init_user_mstate(tbase, tsize);
3692 m->_seg._sflags = USE_MMAP_BIT;
3693 m->set_lock(locked);
3694 }
3695 }
3696 return (mspace)m;
3697}
3698
3699SPP_API size_t destroy_mspace(mspace msp)
3700{

Callers 1

MSpaceMethod · 0.85

Calls 6

pad_requestFunction · 0.85
top_foot_sizeFunction · 0.85
init_user_mstateFunction · 0.85
ensure_initializationMethod · 0.80
granularity_alignMethod · 0.80
set_lockMethod · 0.80

Tested by

no test coverage detected