[Libav-user] Memory issues when using the trim filter

Tobias Rapp t.rapp at noa-archive.com
Wed Apr 10 16:00:26 EEST 2019


On 10.04.2019 14:07, Carl Eugen Hoyos wrote:
> 2019-04-10 14:02 GMT+02:00, Tobias Rapp <t.rapp at noa-archive.com>:
>> [...]
>>
>> When playing back an SD input file the memory usage of the example
>> binary reaches ~1GiB after less than a minute.
> 
>> Running the command with valgrind doesn't show leaked memory.
> 
> massif allows to see where the memory is allocated.

Thanks for the hint. The output file contains a lot of stacktraces that 
look like this (full file attached):

#-----------
snapshot=63
#-----------
time=29114488380
mem_heap_B=997350860
mem_heap_extra_B=55004
mem_stacks_B=0
heap_tree=peak
n2: 997350860 (heap allocation functions) malloc/new/new[], --alloc-fns, 
etc.
  n2: 992362580 0x10B126E: av_malloc (mem.c:87)
   n1: 987047128 0x10932AC: av_buffer_allocz (buffer.c:72)
    n2: 987047128 0x1093B94: av_buffer_pool_get (buffer.c:312)
     n1: 987043001 0x79D970: avcodec_default_get_buffer2 (decode.c:1633)
      n1: 987043001 0x79E259: ff_get_buffer (decode.c:1895)
       n1: 987043001 0x9E7C1E: ff_thread_get_buffer (pthread_frame.c:890)
        n1: 987043001 0x8B428B: decode_frame (huffyuvdec.c:934)
         n1: 987043001 0x79B93E: decode_receive_frame_internal 
(decode.c:433)
          n1: 987043001 0x79C576: avcodec_send_packet (decode.c:705)
           n0: 987043001 0x48074E: main (filtering_video.c:240)
     n0: 4127 in 1 place, below massif's threshold (1.00%)
   n0: 5315452 in 16 places, all below massif's threshold (1.00%)
  n0: 4988280 in 29 places, all below massif's threshold (1.00%)


So possibly the AVPacket reference is not dropped anymore after trim has 
reached its end position? But the filter pipeline is working on AVFrames 
so I'm a bit confused.

Regards,
Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: massif.out.21447.gz
Type: application/x-gzip
Size: 5582 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20190410/51d86108/attachment.bin>


More information about the Libav-user mailing list