我需要知道如何找到计算机的内存对齐方式(Windows 7)。 这是因为我正在撰写我的论文,而我正在使用的第四方DSP通信板的dll数据是以4096对齐方式发送和接收的,但问题是为什么会这样呢?为了找到这个,我必须知道我的电脑的对齐方式。
答案 0 :(得分:0)
来自'man memalign' - 从这里开始。 DSP组件可以使用PC的另一个对齐方式,它取决于其内部架构,总线将其与主机连接。
On many systems there are alignment restrictions, for example, on buffers used for direct block
device I/O. POSIX specifies the pathconf(path,_PC_REC_XFER_ALIGN) call that tells what alignment is
needed. Now one can use posix_memalign() to satisfy this requirement.
posix_memalign() verifies that alignment matches the requirements detailed above. memalign() may not
check that the boundary argument is correct.
POSIX requires that memory obtained from posix_memalign() can be freed using free(3). Some systems
provide no way to reclaim memory allocated with memalign() or valloc() (because one can only pass to
free(3) a pointer gotten from malloc(3), while, for example, memalign() would call malloc(3) and then
align the obtained value). The glibc implementation allows memory obtained from any of these three
routines to be reclaimed with free(3).
The glibc malloc(3) always returns 8-byte aligned memory addresses, so these routines are only needed
if you require larger alignment values.
答案 1 :(得分:0)
正如我在上面的评论中提到的那样,只是为了澄清我的问题已经解决,因为我知道对于PCIe,最大对齐是4096字节。
感谢