Skip to content
PageAllocatorInitAligned

PageAllocatorInitAligned

Description

Initialize a PageAllocator with a custom alignment floor. Page-backed memory is naturally page-aligned, so requests below the page size are rounded up. Stronger-than-page alignment is best-effort.

Success

Returns a fully-initialised PageAllocator value with the requested alignment floor recorded in base.alignment.

Failure

Cannot fail at macro-expansion time.

Usage example (Cross-references)

Usage examples (Cross-references)
        // assert page-alignment here since that is what mmap guarantees
        // portably.
        PageAllocator alloc      = PageAllocatorInitAligned(64);
        Allocator    *alloc_base = ALLOCATOR_OF(&alloc);
        size          page       = PageAllocatorPageSize(&alloc);
    
    static bool deadend_commit_aborts_on_non_pow2_alignment(void) {
        PageAllocator alloc = PageAllocatorInitAligned(3);
    
        IntGraph graph = GraphInit(&alloc);
Last updated on