[FFmpeg-trac] #2716(avformat:new): Memory leak at avformat_new_stream

FFmpeg trac at avcodec.org
Wed Jun 26 14:04:11 CEST 2013


#2716: Memory leak at avformat_new_stream
-------------------------------------+-------------------------------------
             Reporter:               |                    Owner:
  er.anshul.maheshwari@…             |                   Status:  new
                 Type:  defect       |                Component:  avformat
             Priority:  normal       |               Resolution:
              Version:  git-master   |               Blocked By:
             Keywords:  memory leak  |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------

Comment (by er.anshul.maheshwari@…):

 I checked the memory footprint of example, and found that
 codec->private_data is freed
 by avcodec_close.

 I think that if avformat is allocating some Context using libavcodec,
 then libavformat should deallocate, but it is expecting user to call
 avcodec_close.

 If guys you feel that avcodec_close should be called by user, at least we
 should
 mention in comment above avformat_new_stream.

 Still 7 bytes are leak

 =14859== total heap usage: 10,873 allocs, 10,851 frees, 169,396,375 bytes
 allocated
 ==14859==
 ==14859== 7 bytes in 1 blocks are definitely lost in loss record 5 of 19
 ==14859== at 0x40294EB: memalign (in
 /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
 ==14859== by 0x4A7A829: av_strdup (mem.c:241)
 ==14859== by 0x4A7BA2B: set_string (opt.c:172)
 ==14859== by 0x4A7C1BA: av_opt_set (opt.c:267)
 ==14859== by 0x4A7EB6A: av_opt_set_defaults2 (opt.c:1001)
 ==14859== by 0x4A7E9CF: av_opt_set_defaults (opt.c:961)
 ==14859== by 0x46315FF: avcodec_get_context_defaults3 (options.c:136)
 ==14859== by 0x46316D2: avcodec_alloc_context3 (options.c:157)
 ==14859== by 0x49755C8: avformat_new_stream (utils.c:3258)
 ==14859== by 0x4AA4FBD: add_stream (muxing.c:32)
 ==14859== by 0x4AA5269: init (muxing.c:121)
 ==14859== by 0x8048904: main (test_app.c:52)
 ==14859==
 ==14859== LEAK SUMMARY:
 ==14859== definitely lost: 7 bytes in 1 blocks
 ==14859== indirectly lost: 0 bytes in 0 blocks
 ==14859== possibly lost: 0 bytes in 0 blocks
 ==14859== still reachable: 2,074,154 bytes in 21 blocks
 ==14859== suppressed: 0 bytes in 0 blocks
 ==14859== Reachable blocks (those to which a pointer was found) are not
 shown.
 ==14859== To see them, rerun with: --leak-check=full --show-reachable=yes

 I don't know how to remove that attached file, otherwise i have attached
 another file
 with license on top. if any one know please help.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2716#comment:8>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list