[Ffmpeg-devel] [RFC] another attempt at memalign realloc

Michael Niedermayer michaelni
Thu Dec 7 20:46:40 CET 2006


Hi

On Thu, Dec 07, 2006 at 08:38:47PM +0100, Michael Niedermayer wrote:
> Hi
> 
> On Thu, Dec 07, 2006 at 07:59:04PM +0100, Reimar D?ffinger wrote:
> > Hello,
> > On Thu, Dec 07, 2006 at 07:35:19PM +0100, Michael Niedermayer 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.
> > > 
> > > this is not good IMHO realloc() on a sane system should be pretty fast if
> > > no actuall realloc is needed
> > 
> > We could of course completely switch to the MEMALIGN_HACK variant :-P.
> > Except that, to me it currently seems that we have to choose two out of:
> > 1) exact realloc behaviour
> 
> IMHO senseless if its hard 
> av_realloc(NULL, size) should work 
> av_realloc(ptr, 0) = av_free(ptr) is not really usefull IMHO

and if realloc() fails then you have a problem anyway it doesnt seem like
preserving the source will help that much
a program which reallocs a array with critical data and expects the source
to be preserved in a OOM situation is already broken by design as on half
of the OSs it will be sent to hades by the OOM killer demon instead of
getting a NULL return with preserved source

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you really think that XML is the answer, then you definitly missunderstood
the question -- Attila Kinali




More information about the ffmpeg-devel mailing list