Skip to content

Commit

Permalink
port_posix: use posix_memalign() for aligned_alloc
Browse files Browse the repository at this point in the history
Summary:
to workaround issue of http://tracker.ceph.com/issues/21422 .
and in tcmalloc aligned_alloc and posix_memalign() are basically the
same thing. the same applies to GNU glibc.

fixes facebook#3175

Signed-off-by: Kefu Chai <[email protected]>
Closes facebook#3862

Differential Revision: D8147930

Pulled By: yiwu-arbug

fbshipit-source-id: 355afe93c4dd0a96a0d711ef190e8b86fbe8d11d
  • Loading branch information
tchaikov authored and facebook-github-bot committed May 24, 2018
1 parent 7a99c04 commit c465509
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions port/port_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ int GetMaxOpenFiles() {
void *cacheline_aligned_alloc(size_t size) {
#if __GNUC__ < 5 && defined(__SANITIZE_ADDRESS__)
return malloc(size);
#elif defined(_ISOC11_SOURCE)
return aligned_alloc(CACHE_LINE_SIZE, size);
#elif ( _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || defined(__APPLE__))
void *m;
errno = posix_memalign(&m, CACHE_LINE_SIZE, size);
Expand Down

0 comments on commit c465509

Please sign in to comment.