[Libva] libva memory leak

Shuang He shuang.he at intel.com
Wed Jun 8 20:11:46 PDT 2011


The basic idea is let valgrind know what memory we have allocated via 
special ioctl, by using following valgrind APIs:
     VALGRIND_MALLOCLIKE_BLOCK()
     VALGRIND_FREELIKE_BLOCK()
That patch haven't been updated for a long while, attached for your 
reference

Thanks
     --Shuang

On 2011/6/9 10:59, Xiang, Haihao wrote:
> CC Shuang
>
>
>> Hi,
>>
>>    The objects used in i965 driver are allocated via special ioctl, so
>> valgrind can not track the pointer without patching libdrm.
>>
>>    Shuang has a patch for libdrm, maybe he can help you.
>>
>> Thanks
>> Haihao
>>
>>> Hi,
>>>
>>> it looks like libva is leaking memory, I played around with my xine vaapi
>>> implementation and mplayer. With both valgrind produces the following
>>> output :
>>>
>>> ==17727== Invalid write of size 4
>>> ==17727==    at 0x15FD212A: intel_batchbuffer_emit_dword (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x15FE3BFE: i965_avc_bsd_pipeline (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x15FD693F: i965_media_h264_states_setup (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x15FD4817: i965_media_decode_picture (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x15FE0AEE: i965_EndPicture (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0xBF5FA0F: vaEndPicture (in /usr/lib/libva.so.1.0.13)
>>> ==17727==    by 0xB42EE6: ff_vaapi_common_end_frame (in /usr/bin/mplayer)
>>> ==17727==    by 0x867139: ??? (in /usr/bin/mplayer)
>>> ==17727==    by 0x87484C: ??? (in /usr/bin/mplayer)
>>> ==17727==    by 0x9FF31F: avcodec_decode_video2 (in /usr/bin/mplayer)
>>> ==17727==    by 0x664260: ??? (in /usr/bin/mplayer)
>>> ==17727==    by 0x5699CA: decode_video (in /usr/bin/mplayer)
>>> ==17727==  Address 0x7f7caa73e230 is not stack'd, malloc'd or (recently)
>>> free'd
>>> ==17727==
>>> ==17727== Invalid read of size 1
>>> ==17727==    at 0x15FE2393: i965_avc_bsd_get_slice_bit_offset (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x15FE2767: i965_avc_bsd_object (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x15FE3C2A: i965_avc_bsd_pipeline (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x15FD693F: i965_media_h264_states_setup (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x15FD4817: i965_media_decode_picture (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x15FE0AEE: i965_EndPicture (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0xBF5FA0F: vaEndPicture (in /usr/lib/libva.so.1.0.13)
>>> ==17727==    by 0xB42EE6: ff_vaapi_common_end_frame (in /usr/bin/mplayer)
>>> ==17727==    by 0x867139: ??? (in /usr/bin/mplayer)
>>> ==17727==    by 0x87484C: ??? (in /usr/bin/mplayer)
>>> ==17727==    by 0x9FF31F: avcodec_decode_video2 (in /usr/bin/mplayer)
>>> ==17727==    by 0x664260: ??? (in /usr/bin/mplayer)
>>> ==17727==  Address 0x7f7caa73d000 is not stack'd, malloc'd or (recently)
>>> free'd
>>>
>>> --17727-- REDIR: 0xd159710 (memalign) redirected to 0x4c23880 (memalign)
>>> ==17727== Invalid write of size 8
>>> ==17727==    at 0x15FD9975: i965_render_vs_unit (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x15FDBEAA: intel_render_put_surface (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x15FDE676: i965_PutSurface (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x50FB3C: ??? (in /usr/bin/mplayer)
>>> ==17727==    by 0x510CF1: ??? (in /usr/bin/mplayer)
>>> ==17727==    by 0x4DEE62: main (in /usr/bin/mplayer)
>>> ==17727==  Address 0x7f7caa5c3000 is not stack'd, malloc'd or (recently)
>>> free'd
>>> ==17727==
>>> ==17727== Invalid write of size 8
>>> ==17727==    at 0x15FD997C: i965_render_vs_unit (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x15FDBEAA: intel_render_put_surface (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x15FDE676: i965_PutSurface (in
>>> /usr/lib/dri/i965_drv_video.so)
>>> ==17727==    by 0x50FB3C: ??? (in /usr/bin/mplayer)
>>> ==17727==    by 0x510CF1: ??? (in /usr/bin/mplayer)
>>> ==17727==    by 0x4DEE62: main (in /usr/bin/mplayer)
>>> ==17727==  Address 0x7f7caa5c3008 is not stack'd, malloc'd or (recently)
>>> free'd
>>>
>>> The memory usage in mplayer and xine is growing and not freed. Also the cpu
>>> usage is going up in both implementations.
>>>
>>> lg
>>>
>>> Ed
>>> _______________________________________________
>>> Libva mailing list
>>> Libva at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/libva
>>
>> _______________________________________________
>> Libva mailing list
>> Libva at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/libva
>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: drm_valgrind.patch
URL: <http://lists.freedesktop.org/archives/libva/attachments/20110609/2dfd4864/attachment-0001.asc>


More information about the Libva mailing list