[OpenSIPS-Devel] [OpenSIPS/opensips] c09421: Memory allocators: Improve the memory alignment su...

Liviu Chircu noreply at github.com
Thu Jul 1 14:50:59 EST 2021


  Branch: refs/heads/3.1
  Home:   https://github.com/OpenSIPS/opensips
  Commit: c09421db7a224e79364b145529b1f2a51562233a
      https://github.com/OpenSIPS/opensips/commit/c09421db7a224e79364b145529b1f2a51562233a
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2021-07-01 (Thu, 01 Jul 2021)

  Changed paths:
    M mem/f_malloc.c
    M mem/f_malloc.h
    M mem/f_malloc_dyn.h
    M mem/hp_malloc.c
    M mem/hp_malloc.h
    M mem/q_malloc.c
    M mem/q_malloc.h
    M mem/test/test_malloc.c

  Log Message:
  -----------
  Memory allocators: Improve the memory alignment support

This patch fixes the support for configurable memory alignment, such
that the ROUNDTO macro is now truly customizable, for any allocator.  As
long as the ROUNDTO is a multiple of 2, the allocators will return
memory aligned to any required multiple.

The defaults are still the same, as follows:
    * F_MALLOC: 8-byte aligned memory addresses
    * HP_MALLOC: 8-byte aligned memory addresses
    * Q_MALLOC: 16-byte aligned memory addresses (the default in libc!)

Also extend the allocator testing suite with memory alignment tests.
Related to #2546

(cherry picked from commit 1f55d05c2b786ee8cca227ff367d49145bed51a4)





More information about the Devel mailing list