When do we need to use posix_memalign instead of malloc?

Viewed 12512

Seems posix_memalign let you choose a customized alignment,but when is that necessary?

malloc has already done the alignment work internally.

UPDATE

The exact reason I ask this is because I see nginx does this,ngx_memalign(NGX_POOL_ALIGNMENT, size, log);,here NGX_POOL_ALIGNMENT is defined as 16, nginxs.googlecode.com/svn-history/trunk/src/core/ngx_palloc.c

4 Answers
Related