posix_memalign与mmap有何不同

Met*_*est 0 c linux gcc x86-64

如何posix_memalign与对齐大小为4096个字节有所不同mmap?它是内部使用mmap还是其他机制?

Fre*_*Foo 5

posix_memalign是一种更高层次的API相比mmap,设计与互操作malloc,freerealloc.mmap用法更复杂,因为它提供的功能比posix_memalign(将文件映射到进程的地址空间)更多.它的实现方式(以mmap其他方式或其他方式)未指定POSIX标准.

如果没有对齐限制,请使用posix_memalign您使用的malloc位置.