MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / extent_alloc_core

Function extent_alloc_core

deps/jemalloc/src/extent.c:1208–1236  ·  view source on GitHub ↗

* If the caller specifies (!*zero), it is still possible to receive zeroed * memory, in which case *zero is toggled to true. arena_extent_alloc() takes * advantage of this to avoid demanding zeroed extents, but taking advantage of * them if they are returned. */

Source from the content-addressed store, hash-verified

1206 * them if they are returned.
1207 */
1208static void *
1209extent_alloc_core(tsdn_t *tsdn, arena_t *arena, void *new_addr, size_t size,
1210 size_t alignment, bool *zero, bool *commit, dss_prec_t dss_prec) {
1211 void *ret;
1212
1213 assert(size != 0);
1214 assert(alignment != 0);
1215
1216 /* "primary" dss. */
1217 if (have_dss && dss_prec == dss_prec_primary && (ret =
1218 extent_alloc_dss(tsdn, arena, new_addr, size, alignment, zero,
1219 commit)) != NULL) {
1220 return ret;
1221 }
1222 /* mmap. */
1223 if ((ret = extent_alloc_mmap(new_addr, size, alignment, zero, commit))
1224 != NULL) {
1225 return ret;
1226 }
1227 /* "secondary" dss. */
1228 if (have_dss && dss_prec == dss_prec_secondary && (ret =
1229 extent_alloc_dss(tsdn, arena, new_addr, size, alignment, zero,
1230 commit)) != NULL) {
1231 return ret;
1232 }
1233
1234 /* All strategies for allocation failed. */
1235 return NULL;
1236}
1237
1238static void *
1239extent_alloc_default_impl(tsdn_t *tsdn, arena_t *arena, void *new_addr,

Callers 1

Calls 2

extent_alloc_dssFunction · 0.70
extent_alloc_mmapFunction · 0.70

Tested by

no test coverage detected