Skip to content

Cap standard library allocators' maximum supported alignments to target architecture's page size #7952

@mrakh

Description

@mrakh

Hardware-supported data types have alignment restrictions that are far below the target's page size, and the few people who actually need something beyond page-level alignment (e.g. pointer masking tricks, DMA engine restrictions, huge pages) are better off handling the page mapping themselves anyways.

The benefit of this constraint is that memory allocations via the Allocator interface can be served with at most one system call, the consequences of which are:

  • Simplifies implementation
  • Gets rid of potential race conditions
  • Gives us an OS-enforced upper bound on running time
  • Opens up the possibility to implement an async-signal-safe allocator, for use in signal handlers

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingImplementing this issue could cause existing code to no longer compile or have different behavior.enhancementSolving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions