Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSX lacks memalign

Tags:

c++

c

posix

macos

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.

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.

like image 361
user17925 Avatar asked Oct 13 '08 00:10

user17925


1 Answers

Mac OS X appears to be 16-byte mem aligned.

Quote from the website:

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.

like image 120
paxos1977 Avatar answered Oct 09 '22 18:10

paxos1977