| 1272 | } |
| 1273 | |
| 1274 | static bool |
| 1275 | malloc_init_hard_a0_locked() { |
| 1276 | malloc_initializer = INITIALIZER; |
| 1277 | |
| 1278 | if (config_prof) { |
| 1279 | prof_boot0(); |
| 1280 | } |
| 1281 | malloc_conf_init(); |
| 1282 | if (opt_stats_print) { |
| 1283 | /* Print statistics at exit. */ |
| 1284 | if (atexit(stats_print_atexit) != 0) { |
| 1285 | malloc_write("<jemalloc>: Error in atexit()\n"); |
| 1286 | if (opt_abort) { |
| 1287 | abort(); |
| 1288 | } |
| 1289 | } |
| 1290 | } |
| 1291 | if (pages_boot()) { |
| 1292 | return true; |
| 1293 | } |
| 1294 | if (base_boot(TSDN_NULL)) { |
| 1295 | return true; |
| 1296 | } |
| 1297 | if (extent_boot()) { |
| 1298 | return true; |
| 1299 | } |
| 1300 | if (ctl_boot()) { |
| 1301 | return true; |
| 1302 | } |
| 1303 | if (config_prof) { |
| 1304 | prof_boot1(); |
| 1305 | } |
| 1306 | arena_boot(); |
| 1307 | if (tcache_boot(TSDN_NULL)) { |
| 1308 | return true; |
| 1309 | } |
| 1310 | if (malloc_mutex_init(&arenas_lock, "arenas", WITNESS_RANK_ARENAS, |
| 1311 | malloc_mutex_rank_exclusive)) { |
| 1312 | return true; |
| 1313 | } |
| 1314 | /* |
| 1315 | * Create enough scaffolding to allow recursive allocation in |
| 1316 | * malloc_ncpus(). |
| 1317 | */ |
| 1318 | narenas_auto = 1; |
| 1319 | memset(arenas, 0, sizeof(arena_t *) * narenas_auto); |
| 1320 | /* |
| 1321 | * Initialize one arena here. The rest are lazily created in |
| 1322 | * arena_choose_hard(). |
| 1323 | */ |
| 1324 | if (arena_init(TSDN_NULL, 0, (extent_hooks_t *)&extent_hooks_default) |
| 1325 | == NULL) { |
| 1326 | return true; |
| 1327 | } |
| 1328 | a0 = arena_get(TSDN_NULL, 0, false); |
| 1329 | malloc_init_state = malloc_init_a0_initialized; |
| 1330 | |
| 1331 | return false; |
no test coverage detected