Skip to content

Support C11 free() #51

Open
Open

Description

@phillipjohnston

With aligned_alloc() in the C11 standard, free() is called to free memory, rather than an equivalent aligned_free().

We should update our library with some logic that can be used to correctly call aligned_free() if free() is used instead.

Activity

  1. phillipjohnston commented on May 7, 2020

    @phillipjohnston
    MemberAuthor

    Maybe we waste a few extra bytes in the aligned space... need a "magic" marker that indicates that this was allocated by aligned_malloc(). If the sentinel matches, then we call the aligned version.

  2. belmeopmenieuwesim commented on Jun 14, 2020

    @belmeopmenieuwesim

    👍 I would be all for this. It is good to mimic how GLIBC behaves. And I don't think the costs outweigh the benefit

  3. larkmjc commented on Feb 25, 2024

    @larkmjc

    I implemented this in #91 but it is mostly just posted for review at this moment as it needs more testing. I tried it out in emu test_0007_smp.exe where I use it to allocate save restore space for AVX registers using XSAVE/XRSTOR and that will fault if memory is not 64-byte aligned, and it appears to work, but I have not done exhaustive testing yet.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions