MySQL 9.0.0
Source Code Documentation
my_aligned_malloc.h File Reference
#include <cstddef>

Go to the source code of this file.

Functions

void * my_aligned_malloc (size_t size, size_t alignment)
 Function allocates size bytes and returns a pointer to the allocated memory. More...
 
void my_aligned_free (void *ptr)
 Free allocated memory using my_aligned_malloc function. More...
 

Function Documentation

◆ my_aligned_free()

void my_aligned_free ( void *  ptr)

Free allocated memory using my_aligned_malloc function.

Parameters
[in]ptrPointer to allocated memory using my_aligned_malloc function.

◆ my_aligned_malloc()

void * my_aligned_malloc ( size_t  size,
size_t  alignment 
)

Function allocates size bytes and returns a pointer to the allocated memory.

Size and alignment parameters depend on platform on which the function is executed. Please check posix_memalign, memalign and _aligned_malloc functions for details. To conform with all platforms size should be multiple of aligment and aligment should be power of two.

We can use C++17 aligned new/aligned delete on non-windows platforms once the minimum supported version of tcmalloc becomes >= 2.6.2. Right now TC malloc crashes.

Parameters
[in]sizeMultiple of alignment.
[in]alignmentMemory aligment, which must be power of two.
Returns
Pointer to allocated memory.
See also
my_aligned_free