• Marko Mäkelä's avatar
    MDEV-28836 fixup · 0fa19fde
    Marko Mäkelä authored
    On GNU/Linux, even though the C11 aligned_alloc() appeared in
    GNU libc early on, some custom memory allocators did not
    implement it until recently. For example, before
    gperftools/gperftools@d406f2285390c402e824dd28e6992f7f890dcdf9
    the free() in tcmalloc would fail to free memory that was
    returned by aligned_alloc(), because the latter would map to the
    built-in allocator of libc. The Linux specific memalign() has a
    similar interface and is safer to use, because it has been
    available for a longer time. For AddressSanitizer, we will use
    aligned_alloc() so that the constraint on size can be enforced.
    
    buf_tmp_reserve_compression_buf(): When HAVE_ALIGNED_ALLOC holds,
    round up the size to be an integer multiple of the alignment.
    
    pfs_malloc(): In the unit test stub, round up the size to be an
    integer multiple of the alignment.
    0fa19fde
stub_pfs_global.h 2.69 KB