OSX缺乏memalign可 [英] OSX lacks memalign
问题描述
我工作在C项目,它需要memalign可()。真的,posix_memalign()会做一样好,但达尔文/ OSX缺乏他们两个。
I'm working on a project in C and it requires memalign(). Really, posix_memalign() would do as well, but darwin/OSX lacks both of them.
什么是一个好的解决方案鞋拔子,在memalign可?我不明白POSIX-C code牌,如果我是懵memalign.c并把它放在我的项目 - 我不想要任何病毒类型许可证LGPL-ING我的整个项目。
What is a good solution to shoehorn-in memalign? I don't understand the licensing for posix-C code if I were to rip off memalign.c and put it in my project- I don't want any viral-type licensing LGPL-ing my whole project.
推荐答案
Mac OS X的似乎是的 16字节对齐的纪念品。
Mac OS X appears to be 16-byte mem aligned.
从网站引用:
我有一个很难找到一个明确的
在MacOS X的内存对齐声明
所以我做了我自己的测试。在10.4 / intel的,
堆栈和堆内存是16字节
对齐。所以人们移植软件
可以停止寻找memalign可()和
posix_memalign()。这是没有必要的。
I had a hard time finding a definitive statement on MacOS X memory alignment so I did my own tests. On 10.4/intel, both stack and heap memory is 16 byte aligned. So people porting software can stop looking for memalign() and posix_memalign(). It’s not needed.
这篇关于OSX缺乏memalign可的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!