[Ffmpeg-devel] [RFC] another attempt at memalign realloc
Hervé W.
H.O.W.aka.V+ffmpeg
Thu Dec 7 21:25:13 CET 2006
On 07/12/06, M?ns Rullg?rd <mru at inprovide.com> wrote:
> "Herv? W." <H.O.W.aka.V+ffmpeg at gmail.com> writes:
>
> > Hi,
> >
> > On 07/12/06, Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> wrote:
> >> Hello,
> >> 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
> >> point.
> >
> > 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?
That's true and I realise that an embedded system could be expected to
run out of memory more frequently (given the same multimedia files).
However, my question remains. Does ffmpeg and its various libs try to
use the data after running out of memory?
-V
More information about the ffmpeg-devel
mailing list