[Ffmpeg-devel] [PATCH] Replace av_malloc+memset with av_mallocz

Panagiotis Issaris takis.issaris
Wed Sep 6 15:54:03 CEST 2006


Hi,

Op woensdag 6 september 2006 15:42, schreef Guillaume Poirier:
> > Furthermore, these memory allocations together with several other spread through the
> > project seem not to be checked for failure. Is that on purpose or are they 
> > just not yet implemented?
> 
> AFAIK, it's because memory allocation fails, if a disaster occurs
> (badly OOM for instance, ...) and means that my may be better off
> killing the prgm as the OS will probably kill some prgm to free some
> memory. So by not checking if allocation succeeds, you just guarantee
> that in case of OOM, you will be killed by a segfault rather than
> being killed by the kernel OOM killer.
> I'm not sure which way is cleaner...
Seems about the same, yes...

But on the other hand: Then a segfault could mean that an FFmpeg bug has 
been triggered or that memory allocation failed. So on low-memory systems 
you will not be able to easily distinguish between these two, right? That 
seems just a bit less clean to me, ... but that's just MHO.

With friendly regards,
Takis




More information about the ffmpeg-devel mailing list