[MPlayer-dev-eng] [CRASH] mpi->planes[0] needs to be aligned at least to 16 byte or put_pixels16_sse2 will crash

Zuxy Meng zuxy.meng at gmail.com
Fri Mar 19 08:08:14 CET 2010


2010/3/18 Gianluigi Tiesi <mplayer at netfarm.it>:
> On Wed, Mar 17, 2010 at 09:02:23AM +0200, Uoti Urpala wrote:
>> On Wed, 2010-03-17 at 13:46 +0800, Zuxy Meng wrote:
>> > I mentioned this in another thread several days ago. To fix it once
>> > and for all we'd substitute all call to malloc/memalign and free to
>> > av_malloc and av_free across mplayer, but I can't think of a graceful
>> > way to do this in win32. I tried defining my own malloc/memalign and
>> > free and linking it before libmsvcrt but it didn't work.
>>
>> That won't work. Some allocated strings will come from other libraries
>> and must be freed with the standard free(), and possibly vice versa (you
>> need to give a pointer freeable with standard free() to something). So
>> it's generally not possible to switch the whole program to use an
>> incompatible allocator like that.
>
> this is indeed a bad programming pratic, the most common example
> is interoperability between c and c++
> a library should provide a way to disallocate or mandate the caller
> to do so
>
> Btw this works if all libraries are linked statically, this
> is ok for my binaries but no good for general usage
>
>>
>> If the system lacks any way to allocate aligned memory freeable with
>> standard free() then there is no clean solution.
>
> yes true, but there are already places using selectively av_malloc/av_free
> and even libavcodec uses this.
>
> the best way would be not to use memalign, instead wrap calls, and
> substitue related free with a wrapped version.
>
> This would require some work, but if interested I can propose a patch

Can't wait to see it...:-)


-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6



More information about the MPlayer-dev-eng mailing list