Skip to content

std.heap.SmpAllocator asserts !builtin.single_threaded #25992

Description

@leecannon

Is there a good reason that SmpAllocator asserts not single threaded other than a different implementation might be more efficient in a single threaded situation?

I tried deleting the comptime assert and the allocator worked fine 🤷

comptime {
assert(!builtin.single_threaded); // you're holding it wrong
}

Activity

  1. eamonburns commented on Nov 25, 2025

    @eamonburns
    Contributor

    //! An allocator that is designed for ReleaseFast optimization mode, with
    //! multi-threading enabled.

    Originally, I had thought this meant "built for Release fast, multi-threading supported", but now I think it means "built for ReleaseFast and multi-threading".

    (I think the comma before the "with multi-threading" is technically grammatically incorrect in that case, but anyway 🤷‍♂️)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions