中断系统调用posix_memalign [英] Interrupted system call for posix_memalign
本文介绍了中断系统调用posix_memalign的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到这个例外有posix_memalign。任何想法,为什么我们得到它?
I am getting this exception with posix_memalign. Any idea as to why we get it?
先谢谢了。
推荐答案
此问题已解决的问题:事情是对齐边界应该是2的倍数和的sizeof(无效*)
。所以,如果posinter大小为4个字节,第二个参数应该是4,8,16等相反,我是把它作为唯一的2的倍数,因此它崩溃。
The issue is resolved: The thing is the alignment boundary should be a multiple of 2 and sizeof(void *)
. So if posinter size is 4 bytes, the second argument should be 4, 8, 16 etc. Instead of that i was putting it as only multiple of 2, and hence it was crashing.
Wrong usage: crashes
posix_memalign(&addr, 2, 8);
Correct usage:
posix_memalign(&addr, 4, 8); // Second argument multiple of void* and 2
这篇关于中断系统调用posix_memalign的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文