Re: [AD] malloc() vs align_malloc() |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: Re: [AD] malloc() vs align_malloc()
- From: Chris <chris.kcat@xxxxxxxxxx>
- Date: Fri, 18 Feb 2005 14:47:20 -0800
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=VSaJyK6/WbLasnPpr2fEzSsbIwf8wavzltLnOfkpBZuD6wr4d2I5o+P1MHokqc5RoH6uJunKuJbo5Iq+qfzum8zNSiw4NhTXpfIHXMSAukM9cdw7Hci4pVuJZtrPMkg4kCO3d96ErzWOasuDxSl08+VybCB5i9ecLy/2MbDyyEo=
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.