fn allocate(
        page_allocator: &Arc<Self>,
        pages: &[(PageIndex, &PageBytes)],
    ) -> Vec<(PageIndex, Page<Self::PageInner>)> {
        let mut guard = page_allocator.0.lock().unwrap();
        let core = guard.get_or_insert(MmapBasedPageAllocatorCore::new());
        // It would also be correct to increment the counters after all the
        // allocations, but doing it before gives better performance because
        // the core allocator can memory-map larger chunks.
        ALLOCATED_PAGES.inc_by(pages.len());
        core.allocated_pages += pages.len();
        pages
            .iter()
            .map(|(page_index, contents)| {
                let mut page = core.allocate_page(page_allocator);
                page.copy_from_slice(0, *contents);
                (*page_index, Page(Arc::new(page)))
            })
            .collect()
    }
// See the comments of the corresponding method in `PageAllocator`.
See the comments of the corresponding method in `PageAllocator`.
See the comments of the corresponding method in ` PageAllocator ` .
fn allocate(
        page_allocator: &Arc<Self>,
        pages: &[(PageIndex, &PageBytes)],
    ) -> Vec<(PageIndex, Page<Self::PageInner>)> {
        let mut guard = page_allocator.0.lock().unwrap();
        let core = guard.get_or_insert(MmapBasedPageAllocatorCore::new());
        // It would also be correct to increment the counters after all the
        // allocations, but doing it before gives better performance because
        // the core allocator can memory-map larger chunks.
        ALLOCATED_PAGES.inc_by(pages.len());
        core.allocated_pages += pages.len();
        pages
            .iter()
            .map(|(page_index, contents)| {
                let mut page = core.allocate_page(page_allocator);
                page.copy_from_slice(0, *contents);
                (*page_index, Page(Arc::new(page)))
            })
            .collect()
    }
fn allocate ( page_allocator : & Arc < Self > , pages : & [ ( PageIndex , & PageBytes ) ] , ) -> Vec < ( PageIndex , Page < Self :: PageInner > ) > { let mut guard = page_allocator . 0 . lock ( ) . unwrap ( ) ; let core = guard . get_or_insert ( MmapBasedPageAllocatorCore :: new ( ) ) ; // It would also be correct to increment the counters after all the // allocations, but doing it before gives better performance because // the core allocator can memory-map larger chunks. ALLOCATED_PAGES . inc_by ( pages . len ( ) ) ; core . allocated_pages += pages . len ( ) ; pages . iter ( ) . map ( | ( page_index , contents ) | { let mut page = core . allocate_page ( page_allocator ) ; page . copy_from_slice ( 0 , * contents ) ; ( * page_index , Page ( Arc :: new ( page ) ) ) } ) . collect ( ) }
See the comments of the corresponding method in `PageAllocator`.
See the comments of the corresponding method in ` PageAllocator ` .
page_allocator
&Arc<Self>
pages
&[(PageIndex, &PageBytes)]
page_allocator
&Arc<Self>
pages
&[(PageIndex, &PageBytes)]