3 #ifndef __CDS_OS_LIBC_ALLOC_ALIGNED_H
4 #define __CDS_OS_LIBC_ALLOC_ALIGNED_H
9 namespace cds { namespace OS {
11 /// Allocates memory on a specified alignment boundary
12 static inline void * aligned_malloc(
13 size_t nSize, ///< Size of the requested memory allocation
14 size_t nAlignment ///< The alignment value, which must be an integer power of 2
17 return ::memalign( nAlignment, nSize );
20 /// Frees a block of memory that was allocated with aligned_malloc.
21 static inline void aligned_free(
22 void * pBlock ///< A pointer to the memory block that was returned to the aligned_malloc function
29 using libc::aligned_malloc;
30 using libc::aligned_free;
32 }} // namespace cds::OS
35 #endif // #ifndef __CDS_OS_LIBC_ALLOC_ALIGNED_H