[Libav-user] How to cleanup libavcodec buffers when release is called during decode?

Ratin ratin3 at gmail.com
Tue May 29 07:01:51 CEST 2012


On Sat, May 26, 2012 at 1:03 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Ratin <ratin3 at ...> writes:
>
>> Hi,  for h.264 decode with hardware like Nvidia's VDPAU decoding, what
>> should I do to cleanup the resources when avcodec_release callback is
>> called?
>
>> It seems that there are are some memory leaks when running
>> decode for long period of time.
>
> I am only guessing since you did not provide any valgrind output,
> but did you see the comment for vdpau_render_state.bitstream_buffers?
> Also see MPlayer r29793
>
> Carl Eugen



Hi Carl,
   According to valgrind there is no leak, the leak seems to be kernel
memory leak (SUnreclaim  in /proc/meminfo grows incrementally). Also
mplayer is kind of hard to follow for me, since the release happens
elsewhere, not very straight forward. I am doing the following in
release:

   av_freep(&rndState->bitstream_buffers);
   rndState->bitstream_buffers_allocated=0;

         for(i=0; i<4; i++){
                pic->data[i]= NULL;

  I allocate the video surfaces in the beginning and keep reusing
them. So there is not surface release while packets are being decoded.
I am kind of clueless whats causing this kernel memory leak.

Thanks

Ratin


More information about the Libav-user mailing list