|
From: Steven M. S. <sm...@2B...> - 2004-01-15 01:58:32
|
On Wed, 14 Jan 2004, Ray Cole wrote:
> I had this issue with the CVS version as well. I had to make a change to utils/cpu_accel.c to use memalign rather than posix_memalign in bufalloc(). It now looks like this:
Have you done a 'cvs update' recently? There was code added to
check the alignment of the buffer that posix_memalign() returned
and if the alignment was not correct then to try allocating the
buffer with memalign().
Look in cpu_accel.c - you should see something like this:
if (posix_memalign( &buf, simd_alignment, size))
buf = memalign(pgsize, size);
if (buf && ((int)buf & (simd_alignment - 1)))
{
free(buf);
buf = memalign(pgsize, size);
}
If you don't see that then it's time for 'cvs update'. If you do
see that and it's not working it's a bug and needs to be fixed.
> I would assume this is caused by some glibc bug. I'm using Red Hat 8.0. I don't think I've ever upgraded my glib version. I appear to have versions 1.2.10-8 and 2.3.2-4.80.
Yes, it is a glibc bug. glibc-2.2.5 has posix_memalign() but it
does not honor the alignment request and can return 8 instead of 16
or 64 byte aligned buffers. glibc-2.2.4 is even worse - posix_memalign
exists but always returns an error.
The bug's never been reported to happen though (that I know of) with
glibc-2.3.x (I've never seen it happen on Suse 8.2 or 9.0).
If you still get the message "could not allocate %d bytes aligned ..."
then neither posix_memalign nor memalign is working correctly and
poor ol' mpeg2enc has no choice but to bail out.
Cheers,
Steven Schultz
|