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

Function _mi_segment_page_alloc

3rd/mimalloc-2.0.9/src/segment.c:1598–1605  ·  view source on GitHub ↗

----------------------------------------------------------- Page allocation and free ----------------------------------------------------------- */

Source from the content-addressed store, hash-verified

1596 Page allocation and free
1597----------------------------------------------------------- */
1598mi_page_t* _mi_segment_page_alloc(mi_heap_t* heap, size_t block_size, size_t page_alignment, mi_segments_tld_t* tld, mi_os_tld_t* os_tld) {
1599 mi_page_t* page;
1600 if mi_unlikely(page_alignment > MI_ALIGNMENT_MAX) {
1601 mi_assert_internal(_mi_is_power_of_two(page_alignment));
1602 mi_assert_internal(page_alignment >= MI_SEGMENT_SIZE);
1603 if (page_alignment < MI_SEGMENT_SIZE) { page_alignment = MI_SEGMENT_SIZE; }
1604 page = mi_segment_huge_page_alloc(block_size,page_alignment,heap->arena_id,tld,os_tld);
1605 }
1606 else if (block_size <= MI_SMALL_OBJ_SIZE_MAX) {
1607 page = mi_segments_page_alloc(heap,MI_PAGE_SMALL,block_size,block_size,tld,os_tld);
1608 }

Callers 1

mi_page_fresh_allocFunction · 0.85

Calls 3

mi_unlikelyFunction · 0.85
_mi_is_power_of_twoFunction · 0.85

Tested by

no test coverage detected