Re: [linux-usb] Re: How to get aligned memory?

Stephen Williams (steve@icarus.com)
Fri, 31 Jul 1998 11:37:57 -0700


R.E.Wolff@BitWizard.nl said:
> P.S. Malloc usually returns 16-byte aligned stuff. (At least when I
> wrote the darn thing :-)

A correct malloc must return memory aligned for any C data type. That
usually means double, and for 32bit machines that tends to imply 8 bytes.
(I've written mallocs with 4byte alignment, and regretted it:-)

kmalloc (getting back on topic) doesn't need to consider floating types,
but probably does anyhow. If you need a pool of highly aligned objects,
might I suggess getting a few pages and writing a simple fixed-size-object
allocator?

-- 
Steve Williams                "The woods are lovely, dark and deep.
steve@icarus.com              But I have promises to keep,
steve@picturel.com            and lines to code before I sleep,
http://www.picturel.com       And lines to code before I sleep."

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html