[Libav-user] Memory Leaks?

Harald Schlangmann harry at gps-laptimer.de
Fri Apr 18 13:27:00 CEST 2014


Hi,

Just wanted to close this thread in a defined way… This has been indeed an error on application level. Revisiting the code I posted in my initial mail:

>                if (ret>=0)
>                {
>                    if (frameFinished)
>                    {
>> 
>                        if (!videoSource->pImageConvertRGB565Ctx)
>                            videoSource->pImageConvertRGB565Ctx = sws_getContext (
>                                                                        videoSource->pVideoCodecCtx->width, videoSource->pVideoCodecCtx->height,
>                                                                        videoSource->pVideoCodecCtx->pix_fmt,
>                                                                        videoSource->pVideoCodecCtx->width, videoSource->pVideoCodecCtx->height,
>                                                                        PIX_FMT_RGB565,
>                                                                        SWS_BICUBIC, NULL, NULL, NULL);
> 
>                        sws_scale (videoSource->pImageConvertRGB565Ctx,
>                                   videoSource->pVideoFrameRaw->data, videoSource->pVideoFrameRaw->linesize,
>                                   0, videoSource->pVideoCodecCtx->height,
>                                   videoSource->pFrameRGB565->data, videoSource->pFrameRGB565->linesize);
> 
>                        av_frame_unref (videoSource->pVideoFrameRaw);
> 
>                        break;
>                    }
> 
>                    //  The packet has been used by the ffmpeg engine (both if a frame has been finished or not),
>                    //  we must free the content now
>                    av_free_packet (&packet);
>                }

the problem has been the “break;” to leave the surrounding while loop when a video frame has been finished: although the following comment sounds great, “av_free_packet (&packet);” is certainly not reached when break leaves the loop  then lines above… I recall there has been a programming approach “peer programming”, maybe I should search for this peer to compensate my blindness :-) But at least nobody else saw this in this group either ;-)

Thanks for the answers, it is good to have a support group on this framework!

Greetings Harald

-
Harald Schlangmann
Antwerpener Str. 52, 50672 Köln, Germany
+49 151 2265 4439
Harry at gps-laptimer.de
www.gps-laptimer.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4145 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20140418/ce761f04/attachment.p7s>


More information about the Libav-user mailing list