[Ffmpeg-devel] [RFC] another attempt at memalign realloc
Thu Dec 7 21:10:30 CET 2006
"Herv? W." <H.O.W.aka.V+ffmpeg at gmail.com> writes:
> On 07/12/06, Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> wrote:
>> On Thu, Dec 07, 2006 at 08:50:14PM +0200, Oded Shimon wrote:
>> > On Thu, Dec 07, 2006 at 07:05:55PM +0100, Reimar D?ffinger wrote:
>> > > Actually, there is a rather obvious solution.
>> > > Disadvantage: av_realloc without MEMALIGN_HACK now _always_ has the time
>> > > and space costs of av_malloc.
>> > ...
>> > > - return realloc(ptr, size);
>> > > + p2 = av_malloc(size);
>> > > + if (!p2) return NULL;
>> > > + ptr = realloc(ptr, size);
>> > > + if(!((long)ptr&15))
>> > > + return ptr;
>> > I assume you meant to put the av_malloc line AFTER this line... ?
>> Certainly not! Then we would have no way back if the malloc fails, which
>> conflicts with how realloc is supposed to behave, that's exactly the
> When would malloc fail? no large enough block of available memory,...
> any more conditions? no? That should be pretty rare. Does any of
Never worked with embedded systems, have you?
mru at inprovide.com
More information about the ffmpeg-devel