[FFmpeg-devel] [PATCH][RFC]lavu/mem: Do not realloc in av_fast_alloc() if size == min_size

Carl Eugen Hoyos ceffmpeg at gmail.com
Mon Jan 1 23:32:07 EET 2018

2018-01-01 18:47 GMT+01:00 Paul B Mahol <onemda at gmail.com>:
> On 12/30/17, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
>> 2017-12-30 17:24 GMT+01:00 Derek Buitenhuis <derek.buitenhuis at gmail.com>:
>>> On 12/30/2017 1:44 PM, Carl Eugen Hoyos wrote:
>>>> FFmpeg has an arbitrary allocation limit (2G iirc), av_fast_realloc()
>>>> increases the allocation even if the requested is equal the already
>>>> allocated size. I believe this can lead to unnecessary OOM (no
>>>> testcase) if the requested (and already allocated) size is close to
>>>> our limit.
>>>> Additionally, this avoids an over-allocation for the mov stts patch I
>>>> just sent.
>>>> Attached patch changes the behaviour introduced 15 years ago.
>>> I'm not aware of such a limit within the libraries (there is no allocation
>>> tracking)?
>> I just confirmed the ("arbitrary") limit defaults to INT_MAX which at least
>> on some systems is 2G as claimed above.
> Will you apply this or not?

The patch makes no difference for the committed version of the stts
patch but it may still be a good idea, therefore applied.

Thank you, Carl Eugen

More information about the ffmpeg-devel mailing list