[Cbe-oss-dev] memalign weirdness in newlib

Goffredo Marocchi panajev at gmail.com
Fri Jan 4 04:16:41 EST 2008


I was referring to the functions located in libmisc.h (provided with
the CELL SDK).

http://www.cag.csail.mit.edu/ps3/cellminiref.shtml

""Dynamic allocation

malloc on the SPEs allocates memory that is 8-byte aligned. To
allocate memory with larger alignments (on both the SPU and PPU), use
malloc_align:

    void *malloc_align(size_t size, unsigned int n)

which allocates memory that is 2n-byte aligned (free this memory using
free_align). To use malloc_align/free_align, you must #include
<libmisc.h> and link with libmisc (add -lmisc to the IMPORTS variable
in your SPU program makefile).""

It would be helpful to know if those functions suffer of the same
problem as memalign and free do when used in conjunction.

Regards,

Goffredo Marocchi

On Jan 3, 2008 5:55 PM, Patrick Mansfield <patmans at us.ibm.com> wrote:
>
> On Thu, Jan 03, 2008 at 07:53:36AM +0100, Goffredo Marocchi wrote:
> > Can we avoid the memalign() --> free() problem (how would we free the
> > allocated memory without free() anyways ?) by using malloc_align() and
> > free_align() on SPU's ?
>
> I don't have a workaround (other than building and using newlib with the
> standard malloc/free), and there is no malloc/free_align in newlib.
>
> -- Patrick Mansfield
>



More information about the cbe-oss-dev mailing list