How do you allocate memory that\'s aligned to a specific boundary in C (e.g., cache line boundary)? I\'m looking for malloc/free like implementation that ideally would be as po
Use posix_memalign/free.
posix_memalign
free
int posix_memalign(void **memptr, size_t alignment, size_t size); void* ptr; int rc = posix_memalign(&ptr, alignment, size); ... free(ptr)
posix_memalign is a standard replacement for memalign which, as you mention is obsolete.
memalign