MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / mi_commit_mask_decommit

Function mi_commit_mask_decommit

3rd/mimalloc-2.0.9/src/segment-cache.c:110–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110static mi_decl_noinline void mi_commit_mask_decommit(mi_commit_mask_t* cmask, void* p, size_t total, mi_stats_t* stats)
111{
112 if (mi_commit_mask_is_empty(cmask)) {
113 // nothing
114 }
115 else if (mi_commit_mask_is_full(cmask)) {
116 _mi_os_decommit(p, total, stats);
117 }
118 else {
119 // todo: one call to decommit the whole at once?
120 mi_assert_internal((total%MI_COMMIT_MASK_BITS)==0);
121 size_t part = total/MI_COMMIT_MASK_BITS;
122 size_t idx;
123 size_t count;
124 mi_commit_mask_foreach(cmask, idx, count) {
125 void* start = (uint8_t*)p + (idx*part);
126 size_t size = count*part;
127 _mi_os_decommit(start, size, stats);
128 }
129 mi_commit_mask_foreach_end()
130 }
131 mi_commit_mask_create_empty(cmask);
132}
133
134#define MI_MAX_PURGE_PER_PUSH (4)
135

Callers 2

mi_segment_cache_purgeFunction · 0.85
_mi_segment_cache_pushFunction · 0.85

Calls 4

mi_commit_mask_is_emptyFunction · 0.85
mi_commit_mask_is_fullFunction · 0.85
_mi_os_decommitFunction · 0.85

Tested by

no test coverage detected