Re: [AD] malloc() vs align_malloc()

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Peter Wang wrote:
In the same man page it mentions two obsoleted functions (memalign() and valloc()).

I wouldn't recommend those functions at all. According to my man pages:
"Some systems provide no way to reclaim memory allocated with memalign() or valloc() (because one can only pass to free() a pointer gotten from malloc(), while e.g. memalign() would call malloc() and then align the obtained value)." While GNU libc allows memroy from memalign and valloc to be free'd, it's not standard behavior. You can't safely call free on such an address.

I'd just attempt posix_memalign and fallback to malloc.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/