| 1787 | } |
| 1788 | |
| 1789 | static bool |
| 1790 | malloc_init_hard_a0_locked() { |
| 1791 | malloc_initializer = INITIALIZER; |
| 1792 | |
| 1793 | JEMALLOC_DIAGNOSTIC_PUSH |
| 1794 | JEMALLOC_DIAGNOSTIC_IGNORE_MISSING_STRUCT_FIELD_INITIALIZERS |
| 1795 | sc_data_t sc_data = {0}; |
| 1796 | JEMALLOC_DIAGNOSTIC_POP |
| 1797 | |
| 1798 | /* |
| 1799 | * Ordering here is somewhat tricky; we need sc_boot() first, since that |
| 1800 | * determines what the size classes will be, and then |
| 1801 | * malloc_conf_init(), since any slab size tweaking will need to be done |
| 1802 | * before sz_boot and bin_info_boot, which assume that the values they |
| 1803 | * read out of sc_data_global are final. |
| 1804 | */ |
| 1805 | sc_boot(&sc_data); |
| 1806 | unsigned bin_shard_sizes[SC_NBINS]; |
| 1807 | bin_shard_sizes_boot(bin_shard_sizes); |
| 1808 | /* |
| 1809 | * prof_boot0 only initializes opt_prof_prefix. We need to do it before |
| 1810 | * we parse malloc_conf options, in case malloc_conf parsing overwrites |
| 1811 | * it. |
| 1812 | */ |
| 1813 | if (config_prof) { |
| 1814 | prof_boot0(); |
| 1815 | } |
| 1816 | malloc_conf_init(&sc_data, bin_shard_sizes); |
| 1817 | san_init(opt_lg_san_uaf_align); |
| 1818 | sz_boot(&sc_data, opt_cache_oblivious); |
| 1819 | bin_info_boot(&sc_data, bin_shard_sizes); |
| 1820 | |
| 1821 | if (opt_stats_print) { |
| 1822 | /* Print statistics at exit. */ |
| 1823 | if (atexit(stats_print_atexit) != 0) { |
| 1824 | malloc_write("<jemalloc>: Error in atexit()\n"); |
| 1825 | if (opt_abort) { |
| 1826 | abort(); |
| 1827 | } |
| 1828 | } |
| 1829 | } |
| 1830 | |
| 1831 | if (stats_boot()) { |
| 1832 | return true; |
| 1833 | } |
| 1834 | if (pages_boot()) { |
| 1835 | return true; |
| 1836 | } |
| 1837 | if (base_boot(TSDN_NULL)) { |
| 1838 | return true; |
| 1839 | } |
| 1840 | /* emap_global is static, hence zeroed. */ |
| 1841 | if (emap_init(&arena_emap_global, b0get(), /* zeroed */ true)) { |
| 1842 | return true; |
| 1843 | } |
| 1844 | if (extent_boot()) { |
| 1845 | return true; |
| 1846 | } |
no test coverage detected