site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Re:
http://www.kernel.org/doc/man-pages/online/pages/man3/posix_memalign.3.html
"If size is 0, then posix_memalign() returns either NULL, or a unique pointer value that can later be successfully passed to free(3)."
I'm not to keen on a function either returning NULL or something not NULL, but it would seem that when you align @ 32 here, you're getting a NULL return, hence the failure in FREE since nothing got malloc'ed in that case.
As it happens, the 32-byte & zero request *is* returning a non-NULL pointer ... it's just that the "free" fails for some reason (perhaps incorrectly checking some internal housekeeping information). (I added: printf (" ptr = %p\n", ptr); after each posix_memalign call.) Just for testing clarity, I'd add "ptr = NULL;" after the two free() calls. Speaking of keen, who decided a routine called posix_memalign would ***ALLOCATE*** data ... sheesh. poxis_malloc_aligned would have been a much better name :) (I'd have guessed from the name that it would take your pointer, and round it up (if needed) to the next 32-byte boundary.) Stan _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Stan Sieler