| 559 | } |
| 560 | |
| 561 | bool |
| 562 | pages_boot(void) { |
| 563 | os_page = os_page_detect(); |
| 564 | if (os_page > PAGE) { |
| 565 | malloc_write("<jemalloc>: Unsupported system page size\n"); |
| 566 | if (opt_abort) { |
| 567 | abort(); |
| 568 | } |
| 569 | return true; |
| 570 | } |
| 571 | |
| 572 | #ifndef _WIN32 |
| 573 | mmap_flags = MAP_PRIVATE | MAP_ANON; |
| 574 | #endif |
| 575 | |
| 576 | #ifdef JEMALLOC_SYSCTL_VM_OVERCOMMIT |
| 577 | os_overcommits = os_overcommits_sysctl(); |
| 578 | #elif defined(JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY) |
| 579 | os_overcommits = os_overcommits_proc(); |
| 580 | # ifdef MAP_NORESERVE |
| 581 | if (os_overcommits) { |
| 582 | mmap_flags |= MAP_NORESERVE; |
| 583 | } |
| 584 | # endif |
| 585 | #else |
| 586 | os_overcommits = false; |
| 587 | #endif |
| 588 | |
| 589 | init_thp_state(); |
| 590 | |
| 591 | /* Detect lazy purge runtime support. */ |
| 592 | if (pages_can_purge_lazy) { |
| 593 | bool committed = false; |
| 594 | void *madv_free_page = os_pages_map(NULL, PAGE, PAGE, &committed); |
| 595 | if (madv_free_page == NULL) { |
| 596 | return true; |
| 597 | } |
| 598 | assert(pages_can_purge_lazy_runtime); |
| 599 | if (pages_purge_lazy(madv_free_page, PAGE)) { |
| 600 | pages_can_purge_lazy_runtime = false; |
| 601 | } |
| 602 | os_pages_unmap(madv_free_page, PAGE); |
| 603 | } |
| 604 | |
| 605 | return false; |
| 606 | } |
no test coverage detected