Skip to content

Provide macro indicidating upper bound of memory allocations via MLK_ALLOCΒ #1442

@mkannwischer

Description

@mkannwischer

Allowing customization of MLK_ALLOC enables consumers to implement their own memory allocation routine. Depending on how this is implemented, it may be important to know at compile time the maximum amount of memory that will be allocated (independent of this, it may be important that all memory is allocated in a single MLK_ALLOC - but that is a separate issue).

We should provide a macro to consumers providing the maximum amount of memory any routine for any parameter set will require. The name is tbd, but it could be MLK_MAX_WORKSPACE_SIZE or MLK_MAX_ALLOC.

This should be verified in the MLK_ALLOC macro via static_assert(sizeof(struct) <= MLK_MAX_WORKSPACE_SIZE) (there we can only check a single allocation) and additionally in the alloc_test (here we can check the accumulated allocations).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions